Skip to content

Commit 25226d3

Browse files
Simplify dc_is_backed_declared_property()
Per @arnaudlb's review: !(pi->flags & ZEND_ACC_VIRTUAL) already implies pi->offset == ZEND_VIRTUAL_PROPERTY_OFFSET (they're the same marker on the property_info side), and IS_HOOKED_PROPERTY_OFFSET() is only meaningful on offsets returned by zend_get_property_offset() — not on the raw pi->offset stored in properties_info. The extra checks were dead code. Collapse to a single bitmask test.
1 parent 9072a51 commit 25226d3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

deepclone.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -638,15 +638,11 @@ static zend_always_inline bool dc_class_allowed(HashTable *set, zend_string *nam
638638

639639
static zend_always_inline bool dc_is_backed_declared_property(zend_property_info *pi)
640640
{
641-
/* A "backed declared property" is a non-static, non-virtual property with
642-
* a real backing slot (offset >= ZEND_FIRST_PROPERTY_OFFSET). Hooked
643-
* non-virtual properties qualify (they have a real offset); virtual
644-
* properties and hook-metadata offsets do not. */
645-
return pi
646-
&& !(pi->flags & ZEND_ACC_STATIC)
647-
&& !(pi->flags & ZEND_ACC_VIRTUAL)
648-
&& pi->offset != ZEND_VIRTUAL_PROPERTY_OFFSET
649-
&& !IS_HOOKED_PROPERTY_OFFSET(pi->offset);
641+
/* Non-static, non-virtual property with a real backing slot. ZEND_ACC_VIRTUAL
642+
* already implies pi->offset == ZEND_VIRTUAL_PROPERTY_OFFSET, and
643+
* IS_HOOKED_PROPERTY_OFFSET() is only meaningful on offsets returned by
644+
* zend_get_property_offset() — not on the raw pi->offset. */
645+
return pi && !(pi->flags & (ZEND_ACC_STATIC | ZEND_ACC_VIRTUAL));
650646
}
651647

652648
static zend_always_inline bool dc_is_std_scope_property(zend_property_info *pi)

0 commit comments

Comments
 (0)