mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-12-23 02:11:40 +00:00
error checking and ensure we check version
This commit is contained in:
parent
0bfb5d8a50
commit
48472e9516
2 changed files with 7 additions and 3 deletions
9
gnupg.c
9
gnupg.c
|
@ -136,12 +136,15 @@ static void gnupg_res_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
|
|||
static void gnupg_res_init(gnupg_object *intern TSRMLS_DC){
|
||||
/* init the gpgme-lib and set the default values */
|
||||
gpgme_ctx_t ctx;
|
||||
gpgme_error_t err;
|
||||
gpgme_check_version (NULL);
|
||||
gpgme_new (&ctx);
|
||||
err = gpgme_new(&ctx);
|
||||
if(err == GPG_ERR_NO_ERROR) {
|
||||
#ifdef GNUPG_PATH
|
||||
gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_OpenPGP, GNUPG_PATH, NULL);
|
||||
gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_OpenPGP, GNUPG_PATH, NULL);
|
||||
#endif
|
||||
gpgme_set_armor (ctx,1);
|
||||
gpgme_set_armor (ctx,1);
|
||||
}
|
||||
intern->ctx = ctx;
|
||||
intern->encryptkeys = NULL;
|
||||
intern->encrypt_size = 0;
|
||||
|
|
|
@ -80,6 +80,7 @@ zend_object_value gnupg_keylistiterator_objects_new(zend_class_entry *class_type
|
|||
retval.handle = zend_objects_store_put(intern,NULL,(zend_objects_free_object_storage_t) gnupg_keylistiterator_dtor,NULL TSRMLS_CC);
|
||||
retval.handlers = (zend_object_handlers *) & gnupg_keylistiterator_object_handlers;
|
||||
|
||||
gpgme_check_version(NULL);
|
||||
gpgme_new(&ctx);
|
||||
intern->ctx = ctx;
|
||||
return retval;
|
||||
|
|
Loading…
Reference in a new issue