Repository navigation
Language: eval() cannot override final methods (#24884) - #24900
Merged
Merged
Conversation
Cross-eval inheritance now rejects final method overrides in inheritFromParent, matching FinalMethodOverrideCheck for same-script compile and Zend zend_inheritance.c. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eval()of a child (or trait-using child) that overrides a parentfinalmethod now raises Zend-equivalentE_COMPILE_ERROR(Cannot override final method A::f()), matching same-scriptFinalMethodOverrideCheck.inheritFromParent(php-srcZend/zend_inheritance.c), same pattern as final class consts (Regression: final class constants can be overridden by child class (re-#4455, Zend/zend_inheritance.c) #22329) and final properties (Regression: child can override final plain property on PROFILE=8.4 (re-#22339, Zend/zend_inheritance.c) #22988).Closes #24884
php-src reference
Zend/zend_inheritance.c— final method override checkZend/zend_compile.c— compile-time inheritance for evalTest plan
FinalMethodOverrideCheckFinalMethodOverrideCheckTest(6 cases)final_method_eval_override_fatal(VM); JIT skip pending MCJIT eval deferral (same as Regression: eval child redeclaration of final class const — silent abort, not Zend fatal (re-#22329, Zend/zend_inheritance.c) #22922/Regression: child can override final plain property on PROFILE=8.4 (re-#22339, Zend/zend_inheritance.c) #22988)Verification transcript
Not covered: full
ci-fast/ JIT MCJIT eval inheritance (deferred like sibling cases).Made with Cursor