summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-08-25 11:16:36 +0200
committerRemi Collet <remi@remirepo.net>2020-08-25 11:16:36 +0200
commit8e9422b065b867a366fde3626ea5697fe05aec89 (patch)
tree21164d2b434e0e7f6f9c4b47de0c94fa68a00895
parentff710270cd757cb5cb9d968e90da5ccf9a7b4238 (diff)
add patches for PHP8 from
https://github.com/bukka/php-fann/pull/42 https://github.com/bukka/phpc/pull/1
-rw-r--r--42.patch73
-rw-r--r--php-pecl-fann.spec23
-rw-r--r--phpc.patch422
3 files changed, 513 insertions, 5 deletions
diff --git a/42.patch b/42.patch
new file mode 100644
index 0000000..c9686bb
--- /dev/null
+++ b/42.patch
@@ -0,0 +1,73 @@
+From 23c34676e88ed6aef5fc6b6484a65abb554aa11a Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 25 Aug 2020 10:51:51 +0200
+Subject: [PATCH] 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), \
diff --git a/php-pecl-fann.spec b/php-pecl-fann.spec
index ddb79c6..5adbc21 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-2019 Remi Collet
+# Copyright (c) 2013-2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -27,12 +27,16 @@
Summary: Wrapper for FANN Library
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 1.1.1
-Release: 14%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 17%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: PHP
-URL: http://pecl.php.net/package/%{pecl_name}
-Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
+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
BuildRequires: %{?dtsprefix}gcc
BuildRequires: fann-devel > 2.1
@@ -52,7 +56,7 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele
Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
%endif
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%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}
@@ -99,6 +103,10 @@ sed -e 's/role="test"/role="src"/' \
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)
@@ -230,6 +238,11 @@ fi
%changelog
+* Tue Aug 25 2020 Remi Collet <remi@remirepo.net> - 1.1.1-17
+- add patches for PHP8 from
+ https://github.com/bukka/php-fann/pull/42
+ https://github.com/bukka/phpc/pull/1
+
* Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 1.1.1-14
- rebuild for 7.4.0RC1
diff --git a/phpc.patch b/phpc.patch
new file mode 100644
index 0000000..e292d92
--- /dev/null
+++ b/phpc.patch
@@ -0,0 +1,422 @@
+--- 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