From 327588abf91fec1caea0b762f1eeb2ca94945891 Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Tue, 20 Aug 2024 18:44:42 +0200 Subject: [PATCH] Replace OBJ_PROP_PTR_TO_NUM() with zend_get_property_info_for_slot() I wasn't aware such a function already existed. --- Zend/zend_compile.h | 2 -- Zend/zend_property_hooks.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 69f3ef762ca..c7e31877b5c 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -438,8 +438,6 @@ typedef struct _zend_property_info { ((uint32_t)(XtOffsetOf(zend_object, properties_table) + sizeof(zval) * (num))) #define OBJ_PROP_TO_NUM(offset) \ ((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval)) -#define OBJ_PROP_PTR_TO_NUM(obj, prop) \ - (((char*)prop - (char*)obj->properties_table) / sizeof(zval)) typedef struct _zend_class_constant { zval value; /* flags are stored in u2 */ diff --git a/Zend/zend_property_hooks.c b/Zend/zend_property_hooks.c index 684caafc4dd..b00a526125c 100644 --- a/Zend/zend_property_hooks.c +++ b/Zend/zend_property_hooks.c @@ -141,8 +141,7 @@ static void zho_declared_it_fetch_current(zend_object_iterator *iter) } else if (Z_TYPE_P(property) != IS_REFERENCE) { ZVAL_MAKE_REF(property); - zend_class_entry *ce = zobj->ce; - zend_property_info *prop_info = ce->properties_info_table[OBJ_PROP_PTR_TO_NUM(zobj, property)]; + zend_property_info *prop_info = zend_get_property_info_for_slot(zobj, property); if (ZEND_TYPE_IS_SET(prop_info->type)) { ZEND_REF_ADD_TYPE_SOURCE(Z_REF_P(property), prop_info); }