Skip to content

Commit b72175a

Browse files
committed
Fix GH-21768: ext/reflection: assertion failure on internal virtual properties.
ReflectionProperty::isReadable() and isWritable() asserted prop->hooks being set whenever ZEND_ACC_VIRTUAL is set. Internal classes such as DOMDocument declare virtual properties backed by the object read/write handlers without hooks, tripping the assertion. Assertion introduced in e4f727d.
1 parent f437b8b commit b72175a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

ext/reflection/php_reflection.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6763,8 +6763,7 @@ ZEND_METHOD(ReflectionProperty, isReadable)
67636763
}
67646764

67656765
if (prop->flags & ZEND_ACC_VIRTUAL) {
6766-
ZEND_ASSERT(prop->hooks);
6767-
if (!prop->hooks[ZEND_PROPERTY_HOOK_GET]) {
6766+
if (prop->hooks && !prop->hooks[ZEND_PROPERTY_HOOK_GET]) {
67686767
RETURN_FALSE;
67696768
}
67706769
} else if (obj && (!prop->hooks || !prop->hooks[ZEND_PROPERTY_HOOK_GET])) {
@@ -6855,8 +6854,7 @@ ZEND_METHOD(ReflectionProperty, isWritable)
68556854
}
68566855

68576856
if (prop->flags & ZEND_ACC_VIRTUAL) {
6858-
ZEND_ASSERT(prop->hooks);
6859-
if (!prop->hooks[ZEND_PROPERTY_HOOK_SET]) {
6857+
if (prop->hooks && !prop->hooks[ZEND_PROPERTY_HOOK_SET]) {
68606858
RETURN_FALSE;
68616859
}
68626860
} else if (obj && (prop->flags & ZEND_ACC_READONLY)) {

0 commit comments

Comments
 (0)