diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 696828578fca..1b9dfd08a2cf 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6744,8 +6744,8 @@ ZEND_METHOD(ReflectionProperty, isReadable) RETURN_FALSE; } - if ((prop->flags & ZEND_ACC_VIRTUAL) && prop->hooks) { - if (!prop->hooks[ZEND_PROPERTY_HOOK_GET]) { + if (prop->flags & ZEND_ACC_VIRTUAL) { + if (prop->hooks && !prop->hooks[ZEND_PROPERTY_HOOK_GET]) { RETURN_FALSE; } } else if (obj && (!prop->hooks || !prop->hooks[ZEND_PROPERTY_HOOK_GET])) { diff --git a/ext/reflection/tests/gh25266.phpt b/ext/reflection/tests/gh25266.phpt new file mode 100644 index 000000000000..f2cf9a0bd14d --- /dev/null +++ b/ext/reflection/tests/gh25266.phpt @@ -0,0 +1,13 @@ +--TEST-- +GH-25266: Misaligned zval read in ReflectionProperty::isReadable() on internal virtual property +--EXTENSIONS-- +dom +--FILE-- +isReadable(null, new DOMDocument)); + +?> +--EXPECT-- +bool(true)