You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 = newReflectionProperty(A::class, 'a');
// Access B::avar_dump($r->getRawValue(newB()));
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
The text was updated successfully, but these errors were encountered:
Thank you! Small note: I think the set hook here has no effect. It also writes to $field, which I'm not sure is intentional (it used to refer to the property backing value in an old draft).
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:
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.4
Operating System
No response
The text was updated successfully, but these errors were encountered: