Skip to content

Language: eval() cannot override final methods (#24884) - #24900

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-24884-eval-final-override
Jul 29, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-24884-eval-final-override

Conversation

@PurHur

@PurHur PurHur commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #24884

php-src reference

  • Zend/zend_inheritance.c — final method override check
  • Zend/zend_compile.c — compile-time inheritance for eval

Test plan

Verification transcript

$ php bin/vm.php /tmp/finaleval.php
PHP Fatal error:  Cannot override final method A::f() in /tmp/finaleval.php : eval()'d code on line 1
RC:255

$ php bin/vm.php test/repro/issue_24884_eval_final_method_override.php
PHP Fatal error:  Cannot override final method A::f() in ... : eval()'d code on line 1
RC:255

$ php vendor/bin/phpunit --filter 'final_method_eval_override_fatal|FinalMethodOverrideCheckTest'
OK (7 tests, 17 assertions)

Not covered: full ci-fast / JIT MCJIT eval inheritance (deferred like sibling cases).

Made with Cursor

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>
@PurHur
PurHur merged commit 4b1f8c9 into master Jul 29, 2026
1 check passed
@PurHur
PurHur deleted the agent/issue-24884-eval-final-override branch July 29, 2026 16:28
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: eval() allows overriding final methods — Zend E_COMPILE_ERROR (Zend/zend_inheritance.c)

1 participant