Skip to content

Fix GH-25264: Interface implementation mutates inherited property hooks - #25275

Open
lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25264
Open

lazerg wants to merge 1 commit into
php:PHP-8.4from
lazerg:fix/gh-25264

Conversation

@lazerg

@lazerg lazerg commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant