-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix GH-19548: remove ZEND_ACC_OVERRIDE on property inheritance only if it's not part of shared memory #19551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be fixed in a much simpler way. We can rely on the fact that an unmet inherited #[Override]
property will have already errored when linking the parent. Hence, it's sufficient if we remove the ZEND_ACC_OVERRIDE
flag only when the property belongs to the currently linked class.
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index bbc7a767e1b..8679a53e8ff 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1564,7 +1564,9 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
ZSTR_VAL(parent_info->ce->name));
}
- child_info->flags &= ~ZEND_ACC_OVERRIDE;
+ if (child_info->ce == ce) {
+ child_info->flags &= ~ZEND_ACC_OVERRIDE;
+ }
}
} else {
zend_function **hooks = parent_info->hooks;
81038fa
to
8900ea8
Compare
Oh right, It makes sense given where we are in the inheritance "lifecycle". Thanks, it works really well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the other test, but lgtm otherwise. Thanks!
--EXTENSIONS-- | ||
opcache | ||
--INI-- | ||
opcache.enable_cli=1 | ||
opcache.protect_memory=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be moved to ext/opcache/tests, or this section should be removed entirely. Tests are ran with and without opcache, and opcache.protect_memory=1
is always enabled by run-tests.php.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes of course, tests are cleaned up a bit now 👍
…y if it's not part of shared memory
8900ea8
to
e9e4565
Compare
Thank you @alexandre-daubois! |
Fix #19548