diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 1b9dfd08a2cf..8b97666a512c 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6769,6 +6769,7 @@ retry_declared:; zend_class_init_statics(ce); } zval *prop_val = CE_STATIC_MEMBERS(ce) + prop->offset; + ZVAL_DEINDIRECT(prop_val); RETURN_BOOL(!Z_ISUNDEF_P(prop_val)); } diff --git a/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt b/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt new file mode 100644 index 000000000000..78f2eb8c33f4 --- /dev/null +++ b/ext/reflection/tests/ReflectionProperty_isReadable_indirect.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test ReflectionProperty::isReadable() indirect +--FILE-- +isReadable(null)); +var_dump((new ReflectionProperty('ChildClass', 'prop'))->isReadable(null)); + +ChildClass::$prop = 1; + +var_dump((new ReflectionProperty('ParentClass', 'prop'))->isReadable(null)); +var_dump((new ReflectionProperty('ChildClass', 'prop'))->isReadable(null)); + +?> +--EXPECT-- +bool(false) +bool(false) +bool(true) +bool(true)