Skip to content

Fix GH-22280: Ignore non-finally try blocks#22286

Open
prateekbhujel wants to merge 1 commit into
php:PHP-8.4from
prateekbhujel:prateek/gh22280-goto-finally
Open

Fix GH-22280: Ignore non-finally try blocks#22286
prateekbhujel wants to merge 1 commit into
php:PHP-8.4from
prateekbhujel:prateek/gh22280-goto-finally

Conversation

@prateekbhujel

@prateekbhujel prateekbhujel commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Fixes GH-22280.

zend_check_finally_breakout() checked every try/catch table entry as if it had a finally range. For a plain try/catch, finally_op is zero, so a goto emitted at opcode 0 could be treated as leaving a fake finally block.

Skip entries without a finally_op before checking finally jump boundaries.

Tests run:

  • Manual sapi/cli/php -r reproducer before and after the fix
  • sapi/cli/php run-tests.php -q Zend/tests/try/gh22280.phpt Zend/tests/try/finally_goto_001.phpt Zend/tests/try/finally_goto_002.phpt Zend/tests/try/finally_goto_003.phpt Zend/tests/try/finally_goto_004.phpt Zend/tests/try/finally_goto_005.phpt Zend/tests/try/try_finally_005.phpt Zend/tests/try/try_finally_006.phpt Zend/tests/try/try_finally_007.phpt Zend/tests/try/try_finally_008.phpt Zend/tests/try/try_finally_009.phpt Zend/tests/jump13.phpt Zend/tests/jump17.phpt
  • sapi/cli/php run-tests.php -q Zend/tests/try Zend/tests/jump01.phpt ... Zend/tests/jump17.phpt
  • git diff --cached --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant