Skip to content

Language: reject eval override of final static properties (#24992) - #25007

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-24992-final-plain-properties
Jul 29, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-24992-final-plain-properties

Conversation

@PurHur

@PurHur PurHur commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • inheritFromParent already rejected final instance property overrides across eval (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.
  • Under PHP_COMPILER_PROFILE=8.4, eval('class B extends A { public static $x = … }') could print override_ok while Zend 8.4 fatals Cannot override final property A::$x.
  • Mirror the instance path in PHP (lib/VM.php); JIT MCJIT eval deferral skipped like sibling final-eval cases.

php-src: Zend/zend_inheritance.c — Cannot override final property
PHP: lib/VM.php inheritFromParent + rejectChildOverrideOfFinalStaticProperty

Closes #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=1 then Fatal override
  • PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_24992_final_static_property_eval_override.php → isFinal=1 then Fatal override (was override_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: green
  • bootstrap-inventory --check: tip doc drift (unrelated); release-readiness inventory ok
  • release-readiness --json: user_release_ready=no — first fail helper-runtime-prelink (stale helpers, pre-existing); north-star5-fast ok

Made with Cursor

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

Labels

None yet

Projects

None yet

1 participant