Skip to content

Commit 327588a

Browse files
committed
Replace OBJ_PROP_PTR_TO_NUM() with zend_get_property_info_for_slot()
I wasn't aware such a function already existed.
1 parent c5ae122 commit 327588a

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

Zend/zend_compile.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,6 @@ typedef struct _zend_property_info {
438438
((uint32_t)(XtOffsetOf(zend_object, properties_table) + sizeof(zval) * (num)))
439439
#define OBJ_PROP_TO_NUM(offset) \
440440
((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))
441-
#define OBJ_PROP_PTR_TO_NUM(obj, prop) \
442-
(((char*)prop - (char*)obj->properties_table) / sizeof(zval))
443441

444442
typedef struct _zend_class_constant {
445443
zval value; /* flags are stored in u2 */

Zend/zend_property_hooks.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ static void zho_declared_it_fetch_current(zend_object_iterator *iter)
141141
} else if (Z_TYPE_P(property) != IS_REFERENCE) {
142142
ZVAL_MAKE_REF(property);
143143

144-
zend_class_entry *ce = zobj->ce;
145-
zend_property_info *prop_info = ce->properties_info_table[OBJ_PROP_PTR_TO_NUM(zobj, property)];
144+
zend_property_info *prop_info = zend_get_property_info_for_slot(zobj, property);
146145
if (ZEND_TYPE_IS_SET(prop_info->type)) {
147146
ZEND_REF_ADD_TYPE_SOURCE(Z_REF_P(property), prop_info);
148147
}

0 commit comments

Comments
 (0)