From 8e9422b065b867a366fde3626ea5697fe05aec89 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 25 Aug 2020 11:16:36 +0200 Subject: add patches for PHP8 from https://github.com/bukka/php-fann/pull/42 https://github.com/bukka/phpc/pull/1 --- phpc.patch | 422 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 422 insertions(+) create mode 100644 phpc.patch (limited to 'phpc.patch') 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 -- cgit