[php-src] PR #17714: Fix ReflectionProperty::getRawValue(), setRawValue(), setRawValueWithoutLazyInitialization() for properties overridden with hooks
| From: | arnaud-lb | Date: | Thu, 06 Feb 2025 11:38:45 +0000 |
| Subject: | [php-src] PR #17714: Fix ReflectionProperty::getRawValue(), setRawValue(), setRawValueWithoutLazyInitialization() for properties overridden with hooks | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30681@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17714
Author: arnaud-lb
Fixes GH-17713.
new ReflectionProperty($scope, $propName) keeps a reference to the
zend_property_info of $propName declared in $scope. In
getRawValue() and related methods, we use this reference to check whether the property
is hooked.
However, calling new ReflectionProperty($scope, $propName)->getRawValue($object) is
equivalent to the expression $object->$propName from scope $scope
(except that it bypasses hooks), and thus may access an overridden property. This property may have
hooks and different flags.
Here I fetch the effective property info before checking for hooks and property flags.