Repository navigation
Language: reject eval override of final static properties (#24992) - #25007
Merged
Merged
Conversation
inheritFromParent already blocked final instance property overrides across eval; statics only inherited when absent and skipped child redeclarations, so PROFILE=8.4 eval could override a final static. Mirror the instance path (Zend/zend_inheritance.c) and guard with VM compliance + issue repros. Co-authored-by: Cursor <cursoragent@cursor.com>
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
inheritFromParentalready rejected final instance property overrides acrosseval(Regression: child can override final plain property on PROFILE=8.4 (re-#22339, Zend/zend_inheritance.c) #22988); static finals only copied when absent and silently kept the child's redeclaration.PHP_COMPILER_PROFILE=8.4,eval('class B extends A { public static $x = … }')could printoverride_okwhile Zend 8.4 fatalsCannot override final property A::$x.lib/VM.php); JIT MCJIT eval deferral skipped like sibling final-eval cases.php-src:
Zend/zend_inheritance.c— Cannot override final propertyPHP:
lib/VM.phpinheritFromParent+rejectChildOverrideOfFinalStaticPropertyCloses #24992
Test plan
php bin/vm.php test/repro/maintainer_gap_final_plain_property.php→ exit 255, Cannot declare property … final (reference profile)PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_final_property_profile84.php→isFinal=1then Fatal overridePHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_24992_final_static_property_eval_override.php→isFinal=1then Fatal override (wasoverride_ok)vendor/bin/phpunit --filter final_static_property_eval_override_84 test/compliance/VMTest.php test/compliance/JITTest.php→ OK (1 VM test; JIT skipped MCJIT eval)Gate probe (pre-work)
docker info: greenbootstrap-inventory --check: tip doc drift (unrelated); release-readiness inventory okrelease-readiness --json:user_release_ready=no— first failhelper-runtime-prelink(stale helpers, pre-existing);north-star5-fastokMade with Cursor