[php-src] PR #22286: Fix GH-22280: Ignore non-finally try blocks
| From: | prateekbhujel | Date: | Fri, 12 Jun 2026 07:59:14 +0000 |
| Subject: | [php-src] PR #22286: Fix GH-22280: Ignore non-finally try blocks | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36380@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22286
Author: prateekbhujel
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:
- sapi/cli/php -r 'goto d; try { } catch (Throwable) { } d: try { echo
"try\\n"; } finally { echo "finally\\n"; } echo
"done\\n";' before and after the fix\n- 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\n-
sapi/cli/php run-tests.php -q Zend/tests/try Zend/tests/jump01.phpt ...
Zend/tests/jump17.phpt\n- git diff --cached --check