php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64375
Patch patch revision 2013-03-07 11:37 UTC by bartsmink at gmail dot com

Patch patch for gnupg Bug #64375

Patch version 2013-03-07 11:37 UTC

Return to Bug #64375 | Download this patch
Patch Revisions:

Developer: bartsmink@gmail.com

diff -up gnupg-1.3.2/gnupg.c.php54 gnupg-1.3.2/gnupg.c
--- gnupg-1.3.2/gnupg.c.php54	1970-01-01 10:13:08.000000000 +0100
+++ gnupg-1.3.2/gnupg.c	2012-01-28 08:27:36.770878241 +0100
@@ -18,6 +18,7 @@
 
 #include "php.h"
 #include "php_ini.h"
+#include "zend_exceptions.h"
 #include "ext/standard/info.h"
 #include "php_gnupg.h"
 
@@ -53,7 +54,7 @@ static zend_object_handlers gnupg_object
 				php_error_docref(NULL TSRMLS_CC, E_WARNING, (char*)error); \
 				break; \
 			case 2: \
-				zend_throw_exception(zend_exception_get_default(), (char*) error, 0 TSRMLS_CC); \
+				zend_throw_exception(zend_exception_get_default(TSRMLS_C), (char*) error, 0 TSRMLS_CC); \
 				break; \
 			default: \
 				intern->errortxt = (char*)error; \
@@ -170,7 +171,9 @@ static void gnupg_obj_dtor(gnupg_object
 /* {{{ objects_new */
 zend_object_value gnupg_obj_new(zend_class_entry *class_type TSRMLS_DC){
 	gnupg_object *intern;
+#if PHP_VERSION_ID < 50400
 	zval *tmp;
+#endif
 	zend_object_value retval;
 	
 	intern					=	emalloc(sizeof(gnupg_object));
@@ -179,7 +182,12 @@ zend_object_value gnupg_obj_new(zend_cla
 	
 	ALLOC_HASHTABLE	(intern->zo.properties);
 	zend_hash_init	(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+
+#if PHP_VERSION_ID < 50400
 	zend_hash_copy	(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
+#else
+	object_properties_init( (zend_object*)intern, class_type );
+#endif
 	
 	retval.handle		=	zend_objects_store_put(intern,NULL,(zend_objects_free_object_storage_t) gnupg_obj_dtor,NULL TSRMLS_CC);
 	retval.handlers		=	(zend_object_handlers *) & gnupg_object_handlers;
@@ -379,7 +387,7 @@ PHP_MINFO_FUNCTION(gnupg)
 /* {{{ callback func for setting the passphrase */
 
 gpgme_error_t passphrase_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
-	char uid[16];
+	char uid[17];
 	int idx;
 	char *passphrase = NULL;
 	zval *return_value = NULL;
@@ -407,7 +415,7 @@ gpgme_error_t passphrase_cb (gnupg_objec
 }
 
 gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
-    char uid[16];
+    char uid[17];
     int idx;
     char *passphrase = NULL;
 	zval *return_value = NULL;
@@ -1244,7 +1252,6 @@ PHP_FUNCTION(gnupg_decryptverify){
     gpgme_data_t            in, out;
 	gpgme_decrypt_result_t	decrypt_result;
 	gpgme_verify_result_t	verify_result;
-	gpgme_signature_t       gpg_signatures;
 
 	GNUPG_GETOBJ();
 
@@ -1478,7 +1485,6 @@ PHP_FUNCTION(gnupg_listsignatures){
 	zval	*sig_arr;
 
 	gpgme_key_t		gpgme_key;
-	gpgme_subkey_t	gpgme_subkey;
 	gpgme_user_id_t	gpgme_userid;
 	gpgme_key_sig_t	gpgme_signature;
 
diff -up gnupg-1.3.2/gnupg_keylistiterator.c.php54 gnupg-1.3.2/gnupg_keylistiterator.c
--- gnupg-1.3.2/gnupg_keylistiterator.c.php54	1970-01-01 10:13:08.000000000 +0100
+++ gnupg-1.3.2/gnupg_keylistiterator.c	2012-01-28 08:29:00.317881992 +0100
@@ -23,6 +23,7 @@
 #include "php_ini.h"
 #include "ext/standard/info.h"
 #include "zend_interfaces.h"
+#include "zend_exceptions.h"
 #include "php_gnupg.h"
 #include "php_gnupg_keylistiterator.h"
 
@@ -148,7 +149,7 @@ PHP_METHOD(gnupg_keylistiterator,next){
 		gpgme_key_release(intern->gpgkey);
 	}
 
-	if(intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey)){
+	if((intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey))){
 		gpgme_key_release(intern->gpgkey);
 		intern->gpgkey = NULL;
 	}
@@ -159,7 +160,7 @@ PHP_METHOD(gnupg_keylistiterator,rewind)
 	GNUPG_GET_ITERATOR();
 
 	if((intern->err = gpgme_op_keylist_start(intern->ctx, Z_STRVAL(intern->pattern), 0)) != GPG_ERR_NO_ERROR){
-		zend_throw_exception(zend_exception_get_default(),gpg_strerror(intern->err),1 TSRMLS_CC);
+		zend_throw_exception(zend_exception_get_default(TSRMLS_C),gpg_strerror(intern->err),1 TSRMLS_CC);
 	}
 	if((intern->err = gpgme_op_keylist_next(intern->ctx, &intern->gpgkey))!=GPG_ERR_NO_ERROR){
 		RETURN_FALSE;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC