1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix incorrect zend_hash_find_ptr() on non-ptr in ReflectionProperty::isReadable() (GH-21339)

Fixes OSS-Fuzz #489355368
This commit is contained in:
Ilija Tovilo
2026-03-04 12:55:58 +01:00
committed by GitHub
parent 5307a67ba9
commit 471ae15312
2 changed files with 19 additions and 2 deletions

View File

@@ -6676,7 +6676,7 @@ ZEND_METHOD(ReflectionProperty, isReadable)
zend_class_entry *ce = obj ? obj->ce : intern->ce;
if (!prop) {
if (obj && obj->properties && zend_hash_find_ptr(obj->properties, ref->unmangled_name)) {
if (obj && obj->properties && zend_hash_find(obj->properties, ref->unmangled_name)) {
RETURN_TRUE;
}
handle_magic_get:
@@ -6701,7 +6701,7 @@ handle_magic_get:
if (!obj) {
RETURN_THROWS();
}
if (obj->properties && zend_hash_find_ptr(obj->properties, ref->unmangled_name)) {
if (obj->properties && zend_hash_find(obj->properties, ref->unmangled_name)) {
RETURN_TRUE;
}
}

View File

@@ -0,0 +1,17 @@
--TEST--
OSS-Fuzz #489355368: Incorrect assumption Z_PTR_P assumption
--FILE--
<?php
#[AllowDynamicProperties]
class A {}
$obj = new A;
$obj->prop = 0;
$rp = new ReflectionProperty($obj, 'prop');
var_dump($rp->isReadable(null, $obj));
?>
--EXPECT--
bool(true)