Skip to content

Commit 2ec5f2d

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix GH-22280: Ignore non-finally try blocks (#22286)
2 parents e645c60 + 9e9b309 commit 2ec5f2d

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.5.8
44

5+
- Core:
6+
. Fixed bug GH-22280 (Incorrect compile error for goto to label preceding
7+
try/finally block). (Pratik Bhujel)
8+
59
- BCMath:
610
. Fixed issues with oversized allocations and signed overflow in bcround()
711
and BcMath\Number::round(). (edorian)

Zend/tests/try/gh22280.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-22280: goto to label before try/finally after try/catch
3+
--FILE--
4+
<?php
5+
goto d;
6+
try {
7+
} catch (Throwable) {
8+
}
9+
d: try {
10+
echo "try\n";
11+
} finally {
12+
echo "finally\n";
13+
}
14+
echo "done\n";
15+
?>
16+
--EXPECT--
17+
try
18+
finally
19+
done

Zend/zend_opcode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num
689689
int i;
690690

691691
for (i = 0; i < op_array->last_try_catch; i++) {
692+
if (!op_array->try_catch_array[i].finally_op) {
693+
continue;
694+
}
695+
692696
if ((op_num < op_array->try_catch_array[i].finally_op ||
693697
op_num >= op_array->try_catch_array[i].finally_end)
694698
&& (dst_num >= op_array->try_catch_array[i].finally_op &&

0 commit comments

Comments
 (0)