Skip to content

Language: AOT trait-imported final props keep isFinal + override fatal (#27818) - #27861

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27818-final-plain-property-isfinal
Aug 5, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-27818-final-plain-property-isfinal

Conversation

@PurHur

@PurHur PurHur commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

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=1
  • Same for trait repro maintainer_gap_final_plain_property_trait_84.php on VM + AOT → isFinal=1
  • AOT build of child override of trait-imported final → exit 255, Cannot override final property A::$x
  • vendor/bin/phpunit --filter FinalPropertyOverrideCheckTest → OK (21 tests)
  • vendor/bin/phpunit --filter final_plain_property_trait_isfinal_84 → OK

Verification transcript (Docker script/docker-exec.sh):

wrote / isFinal=1   # plain + trait VM/AOT
PHP Fatal error: Cannot override final property A::$x
AOT_OV:255
OK (21 tests, 53 assertions)
OK (1 test, 5 assertions)

Made with Cursor

#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: final plain properties isFinal=0 + child override accepted under PROFILE=8.4 (re-#27315, Zend/zend_inheritance.c)

1 participant