Closed
Description
Description
ReflectionProperty::getRawValue()
, ::setRawValue()
, ::setRawValueWithoutLazyInitialization()
may call hooks when they reference a property of a parent class, that was overridden in the actual class, with hooks.
The following code:
class A {
public $a = 'A::$a';
}
class B extends A {
public $a = 'B::$a' {
get { printf("Called hook: %s\n", __METHOD__); return $this->a; }
set { printf("Called hook: %s\n", __METHOD__); $field = $value; }
}
}
// Reference A::a
$r = new ReflectionProperty(A::class, 'a');
// Access B::a
var_dump($r->getRawValue(new B()));
Resulted in this output:
Called hook: B::$a::get
string(5) "B::$a"
But I expected this output instead:
string(5) "B::$a"
PHP Version
PHP 8.4
Operating System
No response