[php-src] PR #17739: Fix GH-17736: Assertion failure zend_reference_destroy()
| From: | nielsdos | Date: | Sat, 08 Feb 2025 11:54:09 +0000 |
| Subject: | [php-src] PR #17739: Fix GH-17736: Assertion failure zend_reference_destroy() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30700@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17739
Author: nielsdos
The cache slot for FETCH_OBJ_W in function
test is primed with the class for C. The
next call uses a simplexml instance and reuses the same cache slot. simplexml's
get_property_ptr handler does not use the cache slot, so the old values remain in the cache slot.
When zend_handle_fetch_obj_flags is called this is not guarded by a check for the class
entry. So we end up using the prop_info from the property C::$a instead of the simplexml property.
This patch adds a check for the class entry. I placed the check as late as possible to avoid as much
overhead as possible. An alternative solution is to write NULLs to the cache slot in the
get_property_ptr handlers of extensions that don't use the cache slot, but that is not general:
not only simplexml would need changes, maybe even third party extensions would need changes as well.