[php-src] PR #25275: Fix GH-25264: Interface implementation mutates inherited property hooks
| From: | lazerg | Date: | Sat, 07 Nov 2026 09:56:58 +0000 |
| Subject: | [php-src] PR #25275: Fix GH-25264: Interface implementation mutates inherited property hooks | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40382@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25275
Author: lazerg
When a class implements an interface property it already got from its parent (or from an earlier
interface),
do_inherit_property() hands inherit_property_hook() the
parent's zend_property_info as the child, and it writes into it: it sets the
prototype of the inherited hook functions and adds the interface's abstract hooks to the shared
hooks array. With opcache that memory is in shm, so opcache.protect_memory=1 crashes.
Without opcache the parent changes for everyone: in the issue's example P::$prop
gets a set hook, and after abstract class C implements J, I any later
class implementing only J is asked for I::$prop::set.
Inherited hooks are now only checked, not modified, and when an abstract hook has to be added the
property info is first copied into the implementing class, which is then abstract anyway.
Fixes #25264