From 8f7e291b6a838d1ebd80a4abbdce9a33d8f43948 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 15 Mar 2021 07:00:17 +0100 Subject: update to 1.2.0RC1 drop all patches merged upstream --- .gitignore | 2 + 38.patch | 33 ----- 42.patch | 107 -------------- PHPINFO | 2 +- REFLECTION | 11 +- php-pecl-fann.spec | 54 +++---- phpc.patch | 422 ----------------------------------------------------- 7 files changed, 31 insertions(+), 600 deletions(-) delete mode 100644 38.patch delete mode 100644 42.patch delete mode 100644 phpc.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/38.patch b/38.patch deleted file mode 100644 index e6197f2..0000000 --- a/38.patch +++ /dev/null @@ -1,33 +0,0 @@ -From a5ca783eb121e2e467d70e576dda75dcba5f8ba7 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 4 Sep 2018 09:52:04 +0200 -Subject: [PATCH] fix libraries link order - ---- - config.m4 | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/config.m4 b/config.m4 -index da00fea..e00bfdb 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -34,16 +34,16 @@ if test "$PHP_FANN" != "no"; then - - LIBNAME=fann - LIBSYMBOL=fann_set_user_data -+ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FANN_DIR/$PHP_LIBDIR, FANN_SHARED_LIBADD) -+ PHP_ADD_LIBRARY(m) - - PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, - [ -- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $FANN_DIR/$PHP_LIBDIR, FANN_SHARED_LIBADD) -- AC_CHECK_LIB($LIBNAME,[fann_copy],[ AC_DEFINE(HAVE_FANN_2_2,1,[Fann library version 2.2]) ],[],[-lm]) -+ AC_CHECK_LIB($LIBNAME,[fann_copy],[ AC_DEFINE(HAVE_FANN_2_2,1,[Fann library version 2.2]) ],[],[]) - AC_DEFINE(HAVE_FANN,1,[Fann library found]) - ],[ - AC_MSG_ERROR([wrong libfann version (you need at least version 2.1) or lib not found]) - ],[ -- -L$FANN_DIR/$PHP_LIBDIR -lm - ]) - - PHP_SUBST(FANN_SHARED_LIBADD) diff --git a/42.patch b/42.patch deleted file mode 100644 index 9d20a9a..0000000 --- a/42.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 23c34676e88ed6aef5fc6b6484a65abb554aa11a Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 25 Aug 2020 10:51:51 +0200 -Subject: [PATCH 1/2] adapt for PHP 8 and missing arginfo - ---- - fann.c | 7 ++----- - fann_connection.c | 9 ++++++--- - php_fann.h | 2 +- - 3 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/fann.c b/fann.c -index da5f307..a5c2e68 100644 ---- a/fann.c -+++ b/fann.c -@@ -1445,9 +1445,7 @@ static int php_fann_callback(struct fann *ann, struct fann_train_data *train, - - /* set fci */ - PHPC_FCALL_RETVAL(fci, retval); -- fci.params = PHPC_FCALL_PARAMS_NAME(callback); -- fci.param_count = 6; -- fci.no_separation = 0; -+ PHPC_FCALL_FCI_INIT(fci, callback, 6, 0); - - if (zend_call_function(&fci, &fci_cache TSRMLS_CC) != SUCCESS || PHPC_VAL_ISUNDEF(retval)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An error occurred while invoking the user callback"); -@@ -2173,8 +2171,7 @@ PHP_FUNCTION(fann_create_train_from_callback) - /* set fci */ - PHPC_FCALL_RETVAL(fci, retval); - fci.params = PHPC_FCALL_PARAMS_NAME(callback); -- fci.param_count = 3; -- fci.no_separation = 0; -+ PHPC_FCALL_FCI_INIT(fci, callback, 3, 0); - - /* call callback for each data */ - for (i = 0; i < num_data; i++) { -diff --git a/fann_connection.c b/fann_connection.c -index 4fe818b..7580054 100644 ---- a/fann_connection.c -+++ b/fann_connection.c -@@ -108,13 +108,16 @@ ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO(arginfo_fannconnection_set_weight, 0) - ZEND_ARG_INFO(0, weight) - ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO(arginfo_fannconnection_void, 0) -+ZEND_END_ARG_INFO() - /* }}} */ - - static zend_function_entry fannconnection_funcs[] = { - PHP_ME(FANNConnection, __construct, arginfo_fannconnection___construct, ZEND_ACC_CTOR | ZEND_ACC_PUBLIC) -- PHP_ME(FANNConnection, getFromNeuron, NULL, ZEND_ACC_PUBLIC) -- PHP_ME(FANNConnection, getToNeuron, NULL, ZEND_ACC_PUBLIC) -- PHP_ME(FANNConnection, getWeight, NULL, ZEND_ACC_PUBLIC) -+ PHP_ME(FANNConnection, getFromNeuron, arginfo_fannconnection_void, ZEND_ACC_PUBLIC) -+ PHP_ME(FANNConnection, getToNeuron, arginfo_fannconnection_void, ZEND_ACC_PUBLIC) -+ PHP_ME(FANNConnection, getWeight, arginfo_fannconnection_void, ZEND_ACC_PUBLIC) - PHP_ME(FANNConnection, setWeight, arginfo_fannconnection_set_weight, ZEND_ACC_PUBLIC) - PHPC_FE_END - }; -diff --git a/php_fann.h b/php_fann.h -index 3197a67..7008c04 100644 ---- a/php_fann.h -+++ b/php_fann.h -@@ -232,7 +232,7 @@ PHP_FANN_API extern zend_class_entry *php_fann_FANNConnection_class; - /* macros for dealing with FANNConnection properties */ - #define PHP_FANN_CONN_PROP_NAME(__name) __name, sizeof(__name)-1 - #define PHP_FANN_CONN_PROP_UPDATE(__type, __obj, __name, __value) \ -- zend_update_property_##__type(php_fann_FANNConnection_class, (__obj), \ -+ zend_update_property_##__type(php_fann_FANNConnection_class, PHPC_OBJ_FOR_PROP(__obj), \ - PHP_FANN_CONN_PROP_NAME(__name), (__value) TSRMLS_CC) - #define PHP_FANN_CONN_PROP_DECLARE(__type, __name) \ - zend_declare_property_##__type(php_fann_FANNConnection_class, PHP_FANN_CONN_PROP_NAME(__name), \ - -From f7bfc3d254d24f35462d03ccce19597bae593d38 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 2 Sep 2020 09:39:38 +0200 -Subject: [PATCH 2/2] fix for 8.0.0beta3 - ---- - fann.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/fann.c b/fann.c -index a5c2e68..68dd96b 100644 ---- a/fann.c -+++ b/fann.c -@@ -1618,7 +1618,8 @@ PHP_FUNCTION(fann_destroy) - return; - } - -- RETURN_BOOL(PHPC_RES_CLOSE(z_ann) == SUCCESS); -+ PHPC_RES_CLOSE(z_ann); -+ RETURN_TRUE; - } - /* }}} */ - -@@ -2242,7 +2243,8 @@ PHP_FUNCTION(fann_destroy_train) - return; - } - -- RETURN_BOOL(PHPC_RES_CLOSE(z_train_data) == SUCCESS); -+ PHPC_RES_CLOSE(z_train_data); -+ RETURN_TRUE; - } - /* }}} */ - diff --git a/PHPINFO b/PHPINFO index 35a6b58..844ea70 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,5 +2,5 @@ fann FANN support => enabled -FANN version => 1.1.1 +FANN version => 1.2.0RC1 FANN library version => 2.2 diff --git a/REFLECTION b/REFLECTION index fa58895..4d58f54 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #119 fann version 1.1.1 ] { +Extension [ extension #119 fann version 1.2.0RC1 ] { - Constants [51] { Constant [ string FANN_VERSION ] { 2.2 } @@ -1059,12 +1059,21 @@ Extension [ extension #119 fann version 1.1.1 ] { } Method [ public method getFromNeuron ] { + + - Parameters [0] { + } } Method [ public method getToNeuron ] { + + - Parameters [0] { + } } Method [ public method getWeight ] { + + - Parameters [0] { + } } Method [ public method setWeight ] { diff --git a/php-pecl-fann.spec b/php-pecl-fann.spec index 676fcfd..8106838 100644 --- a/php-pecl-fann.spec +++ b/php-pecl-fann.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-fann # -# Copyright (c) 2013-2020 Remi Collet +# Copyright (c) 2013-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -22,25 +22,22 @@ %else %global ini_name 40-%{pecl_name}.ini %endif -#global prever RC2 + +%global upstream_version 1.2.0 +%global upstream_prever RC1 Summary: Wrapper for FANN Library Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 1.1.1 -Release: 19%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz - -# fann patches -Patch0: https://patch-diff.githubusercontent.com/raw/bukka/php-fann/pull/38.patch -Patch1: https://patch-diff.githubusercontent.com/raw/bukka/php-fann/pull/42.patch -# phpc cumulative patch -Patch10: phpc.patch +Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: fann-devel > 2.1 -BuildRequires: %{?scl_prefix}php-devel > 5.2 +BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -58,28 +55,15 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele %if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} %endif @@ -94,7 +78,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version}%{?prever} NTS +mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS # Don't install tests sed -e 's/role="test"/role="src"/' \ @@ -102,16 +86,10 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 -b .pr38 -%patch1 -p1 -b .pr42 -cd phpc -%patch10 -p1 -b .pr1 -cd .. - # Sanity check, really often broken extver=$(sed -n '/#define PHP_FANN_VERSION/{s/.* "//;s/".*$//;p}' php_fann.h) -if test "x${extver}" != "x%{version}%{?prever}"; then - : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. +if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then + : Error: Upstream extension version is ${extver}, expecting %{upstream_version}%{?upstream_prever}. exit 1 fi cd .. @@ -238,6 +216,10 @@ fi %changelog +* Mon Mar 15 2021 Remi Collet - 1.2.0~RC1-1 +- update to 1.2.0RC1 +- drop all patches merged upstream + * Wed Sep 30 2020 Remi Collet - 1.1.1-19 - rebuild for PHP 8.0.0RC1 diff --git a/phpc.patch b/phpc.patch deleted file mode 100644 index e292d92..0000000 --- a/phpc.patch +++ /dev/null @@ -1,422 +0,0 @@ ---- phpc/phpc.h 2016-06-26 16:59:54.000000000 +0200 -+++ /work/GIT/pecl-and-ext/phpc/phpc.h 2020-08-25 10:43:46.675520654 +0200 -@@ -50,33 +50,13 @@ - #define PHPC_OBJ_INIT_HANDLERS(_name) \ - memcpy(&PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), \ - zend_get_std_object_handlers(), sizeof(zend_object_handlers)) --#define PHPC_CLASS_SET_HANDLER_CREATE(_class_entry, _name) \ -- _class_entry.create_object = PHPC_OBJ_GET_HANDLER_FCE(_name, create) --#define PHPC_OBJ_SET_HANDLER_CLONE(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).clone_obj = PHPC_OBJ_GET_HANDLER_FCE(_name, clone) --#define PHPC_OBJ_SET_HANDLER_COMPARE(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).compare_objects = PHPC_OBJ_GET_HANDLER_FCE(_name, compare) --#define PHPC_OBJ_HAS_HANDLER_GET_GC (PHP_VERSION_ID > 50399) --#if PHPC_OBJ_HAS_HANDLER_GET_GC --#define PHPC_OBJ_SET_HANDLER_GET_GC(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_gc = PHPC_OBJ_GET_HANDLER_FCE(_name, get_gc) --#else --#define PHPC_OBJ_SET_HANDLER_GET_GC(_name) PHPC_NOOP --#endif --#define PHPC_OBJ_HAS_HANDLER_GET_DEBUG_INFO (PHP_VERSION_ID > 50299) --#if PHPC_OBJ_HAS_HANDLER_GET_DEBUG_INFO --#define PHPC_OBJ_SET_HANDLER_GET_DEBUG_INFO(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_debug_info = PHPC_OBJ_GET_HANDLER_FCE(_name, get_debug_info) --#else --#define PHPC_OBJ_SET_HANDLER_GET_DEBUG_INFO(_name) PHPC_NOOP -+ -+/* ZEND_ACC_CTOR and ZEND_ACC_DTOR is removed in 7.4 */ -+#ifndef ZEND_ACC_CTOR -+#define ZEND_ACC_CTOR 0 - #endif --/* there is such handler in 5.2 but we would have to re-implement zend_std_get_properties */ --#define PHPC_OBJ_HAS_HANDLER_GET_PROPERTIES (PHP_VERSION_ID > 50299) --#if PHPC_OBJ_HAS_HANDLER_GET_PROPERTIES --#define PHPC_OBJ_SET_HANDLER_GET_PROPERTIES(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_properties = PHPC_OBJ_GET_HANDLER_FCE(_name, get_properties) --#else --#define PHPC_OBJ_SET_HANDLER_GET_PROPERTIES(_name) PHPC_NOOP -+#ifndef ZEND_ACC_DTOR -+#define ZEND_ACC_DTOR 0 - #endif - - #if PHP_VERSION_ID < 50299 -@@ -85,25 +65,58 @@ - #define phpc_function_entry const zend_function_entry - #endif - -+#if PHP_MAJOR_VERSION < 8 -+#define PHPC_OBJ_FOR_PROP(_obj) (_obj) -+#else -+#define PHPC_OBJ_FOR_PROP(_obj) Z_OBJ_P(_obj) -+/* ZTS */ -+#define TSRMLS_D void -+#define TSRMLS_DC -+#define TSRMLS_C -+#define TSRMLS_CC -+#define TSRMLS_FETCH() -+#endif - --/* initializing properties in obejct (object_properties_init was added in PHP 5.4) */ - #if PHP_VERSION_ID < 50399 --#define PHPC_OBJ_PROPERTIES_INIT(zo, class_type) \ -- { \ -- zval *tmp; \ -- zend_hash_copy((*(zo)).properties, \ -- &(class_type)->default_properties, \ -+/* initializing properties in obejct (object_properties_init was added in PHP 5.4) */ -+#define PHPC_OBJ_PROPERTIES_INIT(_zo, _class_type) \ -+ do { \ -+ zval *_phpc_tmp; \ -+ zend_hash_copy((*(_zo)).properties, \ -+ &(_class_type)->default_properties, \ - (copy_ctor_func_t) zval_add_ref, \ -- (void *) &tmp, \ -+ (void *) &_phpc_tmp, \ - sizeof(zval *)); \ -- } -+ } while(0) -+ -+/* write property */ -+#define PHPC_OBJ_STD_WRITE_PROPERTY(_obj, _member, _value) \ -+ Z_OBJ_HT_P(_obj)->write_property(_obj, _member, _value TSRMLS_CC) - #else - #define PHPC_OBJ_PROPERTIES_INIT object_properties_init -+#define PHPC_OBJ_STD_WRITE_PROPERTY(_obj, _member, _value) \ -+ zend_std_write_property(_obj, _member, _value, NULL TSRMLS_CC) - #endif - - /* common fcall macros */ - #define PHPC_FCALL_PARAMS_NAME(_pname) _phpc_fcall_params__ ## _pname - -+#if PHP_MAJOR_VERSION == 8 -+#define PHPC_FCALL_FCI_INIT(_fci, callback, count, no_separ) \ -+ do { \ -+ (_fci).params = PHPC_FCALL_PARAMS_NAME(callback); \ -+ (_fci).param_count = (count); \ -+ } while (0) -+#else -+#define PHPC_FCALL_FCI_INIT(_fci, callback, count, no_separ) \ -+ do { \ -+ (_fci).params = PHPC_FCALL_PARAMS_NAME(callback); \ -+ (_fci).param_count = (count); \ -+ (_fci).no_separation = (no_separ); \ -+ } while (0) -+#endif -+ -+ - /* integer conversions */ - #define PHPC_CONVERT_NUMBER(_pn, _n, _exc_over, _exc_under, _type_from, _type_to, _max, _min) \ - if (_pn > (_type_from) _max) { \ -@@ -195,6 +208,12 @@ - #define PHPC_STR_FROM_PTR_VAL(_str, _strpv) \ - PHPC_STR_VAL(_str) = *PHPC_STR_VAL(_strpv); \ - PHPC_STR_LEN(_str) = strlen(*PHPC_STR_VAL(_strpv)) -+#define PHPC_STR_FROM_ZVAL(_str, _zv) \ -+ PHPC_STR_VAL(_str) = Z_STRVAL(_zv); \ -+ PHPC_STR_LEN(_str) = Z_STRLEN(_zv) -+#define PHPC_STR_FROM_PZVAL(_str, _pzv) \ -+ PHPC_STR_VAL(_str) = Z_STRVAL_P(_pzv); \ -+ PHPC_STR_LEN(_str) = Z_STRLEN_P(_pzv) - #define PHPC_STR_RETURN(_name) \ - RETURN_STRINGL(PHPC_STR_VAL(_name), PHPC_STR_LEN(_name), 0) - -@@ -347,8 +366,8 @@ - PHPC_OBJ_STRUCT_DECLARE(_name, _obj) = PHPC_OBJ_FROM_ZVAL(_name, _phpc_obj ## _id) - - /* handler setters */ --#define PHPC_OBJ_SET_HANDLER_OFFSET(_name) PHPC_NOOP --#define PHPC_OBJ_SET_HANDLER_FREE(_name) PHPC_NOOP -+#define PHPC_OBJ_SET_SPECIFIC_HANDLER_OFFSET(_handlers, _name) PHPC_NOOP -+#define PHPC_OBJ_SET_SPECIFIC_HANDLER_FREE(_handlers, _name) PHPC_NOOP - - /* read propery */ - #define PHPC_READ_PROPERTY_RV_NAME -@@ -359,6 +378,7 @@ - /* HASH */ - - /* apply count */ -+#define PHPC_HASH_HAS_APPLY_COUNT(_ht) (_ht->nApplyCount > 0) - #define PHPC_HASH_GET_APPLY_COUNT(_ht) _ht->nApplyCount - #define PHPC_HASH_INC_APPLY_COUNT(_ht) _ht->nApplyCount++ - #define PHPC_HASH_DEC_APPLY_COUNT(_ht) _ht->nApplyCount-- -@@ -383,6 +403,12 @@ - #define PHPC_HASH_CSTR_ADD(_ht, _cstr_value, _pzv) \ - zend_hash_add(_ht, _cstr_value, strlen(_cstr_value) + 1, &_pzv, sizeof(_pzv), NULL) - -+/* next insert */ -+#define PHPC_HASH_NEXT_INDEX_INSERT_PTR(_ht, _ptr, _ptr_size) \ -+ zend_hash_next_index_insert(_ht, _ptr, _ptr_size, NULL) -+#define PHPC_HASH_NEXT_INDEX_INSERT(_ht, _pzv) \ -+ zend_hash_next_index_insert(_ht, _pzv, sizeof(_pzv), NULL) -+ - /* update ptr */ - #define PHPC_HASH_INDEX_UPDATE_PTR(_ht, _idx, _ptr, _ptr_size) \ - zend_hash_index_update(_ht, _idx, _ptr, _ptr_size, NULL) -@@ -459,6 +485,13 @@ - #define PHPC_HASH_COPY_EX(_target, _source, _copy_ctr) \ - zend_hash_copy(_target, _source, NULL, NULL, sizeof(zval *)) - -+/* key result constant has been renamed in 5.4 */ -+#if PHP_VERSION_ID < 50399 -+#define _PHPC_HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT -+#else -+#define _PHPC_HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTENT -+#endif -+ - /* iteration for each element */ - #define PHPC_HASH_FOREACH_KEY(_ht, _h, _key) do { \ - HashPosition _pos; \ -@@ -466,7 +499,7 @@ - int _key_type; \ - for (zend_hash_internal_pointer_reset_ex((_ht), &_pos); \ - (_key_type = zend_hash_get_current_key_ex( \ -- (_ht), &PHPC_STR_VAL(_key), &_str_length, &_h, 0, &_pos)) != HASH_KEY_NON_EXISTENT; \ -+ (_ht), &PHPC_STR_VAL(_key), &_str_length, &_h, 0, &_pos)) != _PHPC_HASH_KEY_NON_EXISTENT; \ - zend_hash_move_forward_ex((_ht), &_pos) ) { \ - if (_key_type == HASH_KEY_IS_STRING) { \ - PHPC_STR_LEN(_key) = (int) _str_length - 1; \ -@@ -529,7 +562,15 @@ - } while(0) - - -+/* SYMTABLE */ -+ -+/* update*/ -+#define PHPC_SYMTABLE_UPDATE(_ht, _str, _pzv) \ -+ zend_symtable_update(_ht, PHPC_STR_VAL(_str), PHPC_STR_LEN(_str) + 1, &_pzv, sizeof(_pzv), NULL) -+ -+ - /* ARRAY */ -+ - #define PHPC_ARRAY_ADD_ASSOC_NULL_EX(_arr, _key, _key_len) \ - add_assoc_null_ex(_arr, _key, (_key_len) + 1) - #define PHPC_ARRAY_ADD_ASSOC_BOOL_EX(_arr, _key, _key_len, _b) \ -@@ -642,6 +683,9 @@ - #define PHPC_OBJDEBUG Z_OBJDEBUG_P - #define PHPC_OBJDEBUG_P Z_OBJDEBUG_PP - -+#define PHPC_REFCOUNTED(_zv) 1 -+#define PHPC_REFCOUNTED_P(_pzv) 1 -+ - #define PHPC_PZVAL_CAST_TO_PVAL(_pzv) &_pzv - - #define PHPC_VAL_CAST_TO_ZVAL(_pv) *(_pv) -@@ -659,19 +703,39 @@ - #define PHPC_VAL_COPY(_pv, _zv) ZVAL_ZVAL(_pv, _zv, 1, 0) - #define PHPC_VAL_ASSIGN(_pv, _zv) _pv = _zv - -+#define PHPC_PZVAL_MAKE MAKE_STD_ZVAL -+#define PHPC_PZVAL_FREE FREE_ZVAL -+#define PHPC_PZVAL_SET(_pv, _zv) ZVAL_ZVAL(_pv, _zv, 0, 0) - #define PHPC_PVAL_DEREF(_pv) PHPC_NOOP - #define PHPC_PZVAL_DEREF(_pv) PHPC_NOOP - --#define PHPC_VAL_STR(_pv, _str) \ -+#define PHPC_PZVAL_COPY_INIT INIT_PZVAL_COPY -+#define PHPC_PZVAL_COPY(_pzv_dst, _pzv_src) \ -+ *_pzv_dst = *_pzv_src -+ -+#define PHPC_VAL_NEW_STR(_pv, _str) \ - ZVAL_STRINGL(_pv, PHPC_STR_VAL(_str), PHPC_STR_LEN(_str), 0) -+#define PHPC_VAL_STR PHPC_VAL_NEW_STR - #define PHPC_VAL_CSTR(_pv, _cstr) \ - ZVAL_STRING(_pv, _cstr, 1) - #define PHPC_VAL_CSTRL(_pv, _cstr, _cstr_len) \ - ZVAL_STRINGL(_pv, _cstr, _cstr_len, 1) - --#define PHPC_PZVAL_STR PHPC_VAL_STR --#define PHPC_PZVAL_CSTR PHPC_VAL_CSTR --#define PHPC_PZVAL_CSTRL PHPC_VAL_CSTRL -+#define PHPC_PZVAL_NEW_STR PHPC_VAL_NEW_STR -+#define PHPC_PZVAL_STR PHPC_VAL_STR -+#define PHPC_PZVAL_CSTR PHPC_VAL_CSTR -+#define PHPC_PZVAL_CSTRL PHPC_VAL_CSTRL -+ -+#define PHPC_ZVAL_COPY(_zv_dst, _zv_src) \ -+ _zv_dst = _zv_src -+ -+#define PHPC_ZVAL_NEW_STR(_zv, _str) \ -+ PHPC_VAL_STR(&_zv, _str) -+#define PHPC_ZVAL_STR PHPC_ZVAL_NEW_STR -+#define PHPC_ZVAL_CSTR(_zv, _cstr) \ -+ PHPC_VAL_CSTR(&_zv, _cstr) -+#define PHPC_ZVAL_CSTRL(_zv, _cstr, _cstr_len) \ -+ PHPC_VAL_CSTRL(&_zv, _cstr, _cstr_len) - - #define PHPC_ZVAL_IS_TRUE(_zv) \ - (Z_TYPE(_zv) == IS_BOOL && Z_BVAL(_zv)) -@@ -815,6 +879,8 @@ - #define PHPC_STR_FROM_PTR_STR(_str, _strp) _str = *_strp - #define PHPC_STR_FROM_PTR_VAL(_str, _strpv) _str = *_strpv - #define PHPC_STR_RETURN RETURN_STR -+#define PHPC_STR_FROM_ZVAL(_str, _zv) _str = Z_STR(_zv) -+#define PHPC_STR_FROM_PZVAL(_str, _pzv) _str = Z_STR_P(_pzv) - /* wrapper macros */ - #define PHPC_STR_INIT(_name, _cstr, _len) \ - _name = zend_string_init(_cstr, _len, 0) -@@ -948,26 +1014,34 @@ - PHPC_OBJ_STRUCT_DECLARE(_name, _obj) = PHPC_OBJ_FROM_ZVAL(_name, _phpc_obj ## _id) - - /* handler setters */ --#define PHPC_OBJ_SET_HANDLER_OFFSET(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).offset = XtOffsetOf(PHPC_OBJ_STRUCT_NAME(_name), std) --#define PHPC_OBJ_SET_HANDLER_FREE(_name) \ -- PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).free_obj = PHPC_OBJ_GET_HANDLER_FCE(_name, free) -+#define PHPC_OBJ_SET_SPECIFIC_HANDLER_OFFSET(_handlers, _name) \ -+ (_handlers).offset = XtOffsetOf(PHPC_OBJ_STRUCT_NAME(_name), std) -+#define PHPC_OBJ_SET_SPECIFIC_HANDLER_FREE(_handlers, _name) \ -+ (_handlers).free_obj = PHPC_OBJ_GET_HANDLER_FCE(_name, free) - - /* read propery */ - #define PHPC_READ_PROPERTY_RV_NAME _phpc_read_property_rv - #define PHPC_READ_PROPERTY_RV_DECLARE zval PHPC_READ_PROPERTY_RV_NAME - #define PHPC_READ_PROPERTY(_scope, _object, _name, _name_len, _silent) \ -- zend_read_property(_scope, _object, _name, _name_len, _silent, &PHPC_READ_PROPERTY_RV_NAME) -+ zend_read_property(_scope, PHPC_OBJ_FOR_PROP(_object), _name, _name_len, _silent, &PHPC_READ_PROPERTY_RV_NAME) - - - /* HASH */ - --/* apply count */ --#define PHPC_HASH_GET_APPLY_COUNT ZEND_HASH_GET_APPLY_COUNT --#define PHPC_HASH_INC_APPLY_COUNT ZEND_HASH_INC_APPLY_COUNT --#define PHPC_HASH_DEC_APPLY_COUNT ZEND_HASH_DEC_APPLY_COUNT --#define PHPC_HASH_APPLY_PROTECTION ZEND_HASH_APPLY_PROTECTION -- -+/* recursion protection */ -+#if PHP_VERSION_ID < 70299 -+#define PHPC_HASH_HAS_APPLY_COUNT(_tht) (ZEND_HASH_GET_APPLY_COUNT(_tht) > 0) -+#define PHPC_HASH_GET_APPLY_COUNT ZEND_HASH_GET_APPLY_COUNT -+#define PHPC_HASH_INC_APPLY_COUNT ZEND_HASH_INC_APPLY_COUNT -+#define PHPC_HASH_DEC_APPLY_COUNT ZEND_HASH_DEC_APPLY_COUNT -+#define PHPC_HASH_APPLY_PROTECTION ZEND_HASH_APPLY_PROTECTION -+#else -+#define PHPC_HASH_HAS_APPLY_COUNT GC_IS_RECURSIVE -+#define PHPC_HASH_GET_APPLY_COUNT GC_IS_RECURSIVE -+#define PHPC_HASH_INC_APPLY_COUNT GC_PROTECT_RECURSION -+#define PHPC_HASH_DEC_APPLY_COUNT GC_UNPROTECT_RECURSION -+#define PHPC_HASH_APPLY_PROTECTION(_tht) (!(GC_FLAGS(_tht) & GC_IMMUTABLE)) -+#endif - /* add ptr */ - #define PHPC_HASH_INDEX_ADD_PTR(_ht, _idx, _ptr, _ptr_size) \ - zend_hash_index_add_ptr(_ht, _idx, _ptr) -@@ -984,6 +1058,11 @@ - #define PHPC_HASH_CSTR_ADD(_ht, _cstr_value, _pzv) \ - zend_hash_str_add(_ht, _cstr_value, strlen(_cstr_value), _pzv) - -+/* next insert */ -+#define PHPC_HASH_NEXT_INDEX_INSERT_PTR(_ht, _ptr, _ptr_size) \ -+ zend_hash_next_index_insert_ptr(_ht, _ptr) -+#define PHPC_HASH_NEXT_INDEX_INSERT zend_hash_next_index_insert -+ - /* update ptr */ - #define PHPC_HASH_INDEX_UPDATE_PTR(_ht, _idx, _ptr, _ptr_size) \ - zend_hash_index_update_ptr(_ht, _idx, _ptr) -@@ -1067,6 +1146,12 @@ - #define PHPC_HASH_RETURN RETURN_ARR - - -+/* SYMTABLE */ -+ -+/* update*/ -+#define PHPC_SYMTABLE_UPDATE zend_symtable_update -+ -+ - /* ARRAY */ - - #define PHPC_ARRAY_ADD_ASSOC_NULL_EX add_assoc_null_ex -@@ -1157,6 +1242,9 @@ - #define PHPC_OBJDEBUG Z_OBJDEBUG - #define PHPC_OBJDEBUG_P Z_OBJDEBUG_P - -+#define PHPC_REFCOUNTED Z_REFCOUNTED -+#define PHPC_REFCOUNTED_P Z_REFCOUNTED_P -+ - #define PHPC_PZVAL_CAST_TO_PVAL(_pzv) _pzv - - #define PHPC_VAL_CAST_TO_ZVAL(_pv) _pv -@@ -1174,9 +1262,17 @@ - #define PHPC_VAL_COPY(_pv, _zv) ZVAL_COPY(&(_pv), _zv) - #define PHPC_VAL_ASSIGN PHPC_VAL_COPY - --#define PHPC_PVAL_DEREF ZVAL_DEREF --#define PHPC_PZVAL_DEREF ZVAL_DEREF -+#define PHPC_PZVAL_MAKE(_pzv) PHPC_NOOP -+#define PHPC_PZVAL_FREE(_pzv) PHPC_NOOP -+#define PHPC_PZVAL_SET(_pv, _zv) _pv = _zv -+#define PHPC_PVAL_DEREF ZVAL_DEREF -+#define PHPC_PZVAL_DEREF ZVAL_DEREF -+ -+#define PHPC_PZVAL_COPY_INIT ZVAL_COPY_VALUE -+#define PHPC_PZVAL_COPY ZVAL_COPY_VALUE - -+#define PHPC_VAL_NEW_STR(_pv, _str) \ -+ ZVAL_NEW_STR(&_pv, _str) - #define PHPC_VAL_STR(_pv, _str) \ - ZVAL_STR(&_pv, _str) - #define PHPC_VAL_CSTR(_pv, _cstr) \ -@@ -1184,9 +1280,18 @@ - #define PHPC_VAL_CSTRL(_pv, _cstr, _cstr_len) \ - ZVAL_STRINGL(&_pv, _cstr, _cstr_len) - --#define PHPC_PZVAL_STR ZVAL_STR --#define PHPC_PZVAL_CSTR ZVAL_STRING --#define PHPC_PZVAL_CSTRL ZVAL_STRINGL -+#define PHPC_PZVAL_NEW_STR ZVAL_NEW_STR -+#define PHPC_PZVAL_STR ZVAL_STR -+#define PHPC_PZVAL_CSTR ZVAL_STRING -+#define PHPC_PZVAL_CSTRL ZVAL_STRINGL -+ -+#define PHPC_ZVAL_COPY(_zv_dst, _zv_src) \ -+ ZVAL_COPY_VALUE(&_zv_dst, &_zv_src) -+ -+#define PHPC_ZVAL_NEW_STR PHPC_VAL_NEW_STR -+#define PHPC_ZVAL_STR PHPC_VAL_STR -+#define PHPC_ZVAL_CSTR PHPC_VAL_CSTR -+#define PHPC_ZVAL_CSTRL PHPC_VAL_CSTRL - - #define PHPC_ZVAL_IS_TRUE(_zv) \ - (Z_TYPE(_zv) == IS_TRUE) -@@ -1313,6 +1418,42 @@ - PHPC_OBJ_DEFINE_HANDLER_FCE(HashTable *, _name, get_properties)\ - (zval *PHPC_SELF TSRMLS_DC) - -+/* object handler setters */ -+#define PHPC_CLASS_SET_HANDLER_CREATE(_class_entry, _name) \ -+ _class_entry.create_object = PHPC_OBJ_GET_HANDLER_FCE(_name, create) -+#define PHPC_OBJ_SET_SPECIFIC_HANDLER_CLONE(_handlers, _name) \ -+ (_handlers).clone_obj = PHPC_OBJ_GET_HANDLER_FCE(_name, clone) -+#define PHPC_OBJ_SET_HANDLER_CLONE(_name) \ -+ PHPC_OBJ_SET_SPECIFIC_HANDLER_CLONE(PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), _name) -+#define PHPC_OBJ_SET_HANDLER_COMPARE(_name) \ -+ PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).compare_objects = PHPC_OBJ_GET_HANDLER_FCE(_name, compare) -+#define PHPC_OBJ_HAS_HANDLER_GET_GC (PHP_VERSION_ID > 50399) -+#if PHPC_OBJ_HAS_HANDLER_GET_GC -+#define PHPC_OBJ_SET_HANDLER_GET_GC(_name) \ -+ PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_gc = PHPC_OBJ_GET_HANDLER_FCE(_name, get_gc) -+#else -+#define PHPC_OBJ_SET_HANDLER_GET_GC(_name) PHPC_NOOP -+#endif -+#define PHPC_OBJ_HAS_HANDLER_GET_DEBUG_INFO (PHP_VERSION_ID > 50299) -+#if PHPC_OBJ_HAS_HANDLER_GET_DEBUG_INFO -+#define PHPC_OBJ_SET_HANDLER_GET_DEBUG_INFO(_name) \ -+ PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_debug_info = PHPC_OBJ_GET_HANDLER_FCE(_name, get_debug_info) -+#else -+#define PHPC_OBJ_SET_HANDLER_GET_DEBUG_INFO(_name) PHPC_NOOP -+#endif -+/* there is such handler in 5.2 but we would have to re-implement zend_std_get_properties */ -+#define PHPC_OBJ_HAS_HANDLER_GET_PROPERTIES (PHP_VERSION_ID > 50299) -+#if PHPC_OBJ_HAS_HANDLER_GET_PROPERTIES -+#define PHPC_OBJ_SET_HANDLER_GET_PROPERTIES(_name) \ -+ PHPC_OBJ_GET_HANDLER_VAR_NAME(_name).get_properties = PHPC_OBJ_GET_HANDLER_FCE(_name, get_properties) -+#else -+#define PHPC_OBJ_SET_HANDLER_GET_PROPERTIES(_name) PHPC_NOOP -+#endif -+#define PHPC_OBJ_SET_HANDLER_OFFSET(_name) \ -+ PHPC_OBJ_SET_SPECIFIC_HANDLER_OFFSET(PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), _name) -+#define PHPC_OBJ_SET_HANDLER_FREE(_name) \ -+ PHPC_OBJ_SET_SPECIFIC_HANDLER_FREE(PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), _name) -+ - /* hash */ - #define PHPC_HASH_ALLOC ALLOC_HASHTABLE - #define PHPC_HASH_INIT zend_hash_init -- cgit