From 71d97801e9a15f01e4cab35a69073b40b989196e Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Sun, 29 Jan 2012 02:29:40 +0000 Subject: [PATCH] - PHP 5.4 support - include vars.inc in package.xml - Fix tests to be gnupg version independent fixes bug 60913 fixes bug 60915 --- gnupg.c | 8 ++++++-- package.xml | 1 + tests/gnupg_oo_export.phpt | 4 ++-- tests/gnupg_res_export.phpt | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gnupg.c b/gnupg.c index c14e44a..678bd54 100644 --- a/gnupg.c +++ b/gnupg.c @@ -173,13 +173,17 @@ zend_object_value gnupg_obj_new(zend_class_entry *class_type TSRMLS_DC){ zval *tmp; zend_object_value retval; - intern = emalloc(sizeof(gnupg_object)); + intern = ecalloc(1, sizeof(gnupg_object)); intern->zo.ce = class_type; + +#if PHP_VERSION_ID < 50399 intern->zo.properties = NULL; - ALLOC_HASHTABLE (intern->zo.properties); zend_hash_init (intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); 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(&intern->zo, 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; diff --git a/package.xml b/package.xml index d8868d7..5a394b1 100644 --- a/package.xml +++ b/package.xml @@ -55,6 +55,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + diff --git a/tests/gnupg_oo_export.phpt b/tests/gnupg_oo_export.phpt index 1503ee5..c2028a7 100644 --- a/tests/gnupg_oo_export.phpt +++ b/tests/gnupg_oo_export.phpt @@ -11,8 +11,8 @@ $ret = $gpg -> export($fingerprint); var_dump($ret); ?> --EXPECTF-- -string(1336) "-----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.3 (GNU/Linux) +string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.%d.%d (GNU/Linux) mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3 afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z diff --git a/tests/gnupg_res_export.phpt b/tests/gnupg_res_export.phpt index 7fc14cf..50edf74 100644 --- a/tests/gnupg_res_export.phpt +++ b/tests/gnupg_res_export.phpt @@ -9,8 +9,8 @@ $ret = gnupg_export($gpg, $fingerprint); var_dump($ret); ?> --EXPECTF-- -string(1336) "-----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.3 (GNU/Linux) +string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.%d.%d (GNU/Linux) mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3 afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z