[php-src] PR #20943: Fix by-ref assignment on uninitialized hooked backing value
| From: | iluuu1994 | Date: | Thu, 15 Jan 2026 14:18:22 +0000 |
| Subject: | [php-src] PR #20943: Fix by-ref assignment on uninitialized hooked backing value | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34566@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20943
Author: iluuu1994
Within hooks, the backing value can directly be accessed as if no hooks were present. This was
previously handled only in read_property().
zend_fetch_property_address(), which is used for by-ref assignment, will first call
get_property_ptr_ptr() and then try read_property(). However, when called on uninitialized backing
values, read_property() will return &EG(uninitialized_zval) with an uninitialized property
warning. This is problematic for zend_fetch_property_address() because it write to the result of
read_property() unless there's an exception.
For untyped properties, this can result in writes to &EG(uninitialized_zval) (see
oss-fuzz-471486164-001.phpt). For types properties, it will result in an unexpected "Typed
property C::$prop must not be accessed before initialization" exception.
Fixes OSS-Fuzz #471486164