diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 82cf20f1b5d..7ec8fe3b965 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -1387,13 +1387,6 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) { SEPARATE_ZVAL_IF_NOT_REF(_zv); \ } while (0) -#define SEPARATE_ARG_IF_REF(varptr) do { \ - ZVAL_DEREF(varptr); \ - if (Z_REFCOUNTED_P(varptr)) { \ - Z_ADDREF_P(varptr); \ - } \ - } while (0) - /* Properties store a flag distinguishing unset and uninitialized properties * (both use IS_UNDEF type) in the Z_EXTRA space. As such we also need to copy * the Z_EXTRA space when copying property default values etc. We define separate diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index d2300632b69..176e507a490 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -401,11 +401,8 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *objec if (!offset) { ZVAL_UNDEF(&tmp); offset = &tmp; - } else { - SEPARATE_ARG_IF_REF(offset); } zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset); - zval_ptr_dtor(offset); if (!Z_ISUNDEF_P(rv)) { return rv; @@ -447,11 +444,8 @@ static void spl_array_write_dimension_ex(int check_inherited, zend_object *objec if (!offset) { ZVAL_NULL(&tmp); offset = &tmp; - } else { - SEPARATE_ARG_IF_REF(offset); } zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value); - zval_ptr_dtor(offset); return; } @@ -517,9 +511,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zend_object *objec spl_array_object *intern = spl_array_from_obj(object); if (check_inherited && intern->fptr_offset_del) { - SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset); - zval_ptr_dtor(offset); return; } @@ -598,9 +590,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, zval rv, *value = NULL, *tmp; if (check_inherited && intern->fptr_offset_has) { - SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset); - zval_ptr_dtor(offset); if (zend_is_true(&rv)) { zval_ptr_dtor(&rv); diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 32899690378..4c7ff5dd35d 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -350,11 +350,8 @@ static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *off if (!offset) { ZVAL_NULL(&tmp); offset = &tmp; - } else { - SEPARATE_ARG_IF_REF(offset); } zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_get, "offsetGet", rv, offset); - zval_ptr_dtor(offset); if (!Z_ISUNDEF_P(rv)) { return rv; } @@ -400,13 +397,8 @@ static void spl_fixedarray_object_write_dimension(zend_object *object, zval *off if (!offset) { ZVAL_NULL(&tmp); offset = &tmp; - } else { - SEPARATE_ARG_IF_REF(offset); } - SEPARATE_ARG_IF_REF(value); zend_call_method_with_2_params(object, intern->std.ce, &intern->methods->fptr_offset_set, "offsetSet", NULL, offset, value); - zval_ptr_dtor(value); - zval_ptr_dtor(offset); return; } @@ -439,9 +431,7 @@ static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *off intern = spl_fixed_array_from_obj(object); if (UNEXPECTED(intern->methods && intern->methods->fptr_offset_del)) { - SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_del, "offsetUnset", NULL, offset); - zval_ptr_dtor(offset); return; } @@ -482,9 +472,7 @@ static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset zval rv; zend_bool result; - SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(object, intern->std.ce, &intern->methods->fptr_offset_has, "offsetExists", &rv, offset); - zval_ptr_dtor(offset); result = zend_is_true(&rv); zval_ptr_dtor(&rv); return result;