Repository navigation
Language: AOT trait-imported final props keep isFinal + override fatal (#27818) - #27861
Merged
Merged
Conversation
#27818) Thin AOT missed ZEND_ACC_FINAL when copying trait instance/static properties, so ReflectionProperty::isFinal() stayed false and child redeclarations compiled. Copy markPropertyFinal on trait inherit and teach FinalPropertyOverrideCheck about TraitUse so compile fatals match Zend. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 5, 2026
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
PHP_COMPILER_PROFILE=8.4, thin AOT treated trait-importedfinalplain properties as non-final (isFinal=0) and accepted child redeclarations; class-declared finals were already correct after Language: final plain properties still writable + isFinal=0 under PROFILE=8.4 (re-#26222, Zend/zend_compile.c) #27315.markPropertyFinalinObject_::inheritTraitInstanceProperties/inheritTraitStaticProperties.FinalPropertyOverrideCheckaboutTrait_/TraitUseso compile fatals match Zend (Cannot override final property A::$x).php-src:
Zend/zend_compile.c,Zend/zend_inheritance.c,Zend/zend_traits.c,ext/reflection/php_reflection.c.Test plan
PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/maintainer_gap_final_plain_property_84.php→wrote/isFinal=1maintainer_gap_final_plain_property_trait_84.phpon VM + AOT →isFinal=1Cannot override final property A::$xvendor/bin/phpunit --filter FinalPropertyOverrideCheckTest→ OK (21 tests)vendor/bin/phpunit --filter final_plain_property_trait_isfinal_84→ OKVerification transcript (Docker
script/docker-exec.sh):Made with Cursor