diff --git a/NEWS b/NEWS index 3ec0d319b7e4..7b36fb246790 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.4.23 +- Core: + . Fixed bug GH-22280 (Incorrect compile error for goto to label preceding + try/finally block). (Pratik Bhujel) + - BCMath: . Fixed issues with oversized allocations and signed overflow in bcround() and BcMath\Number::round(). (edorian) diff --git a/Zend/tests/try/gh22280.phpt b/Zend/tests/try/gh22280.phpt new file mode 100644 index 000000000000..30944aff59a6 --- /dev/null +++ b/Zend/tests/try/gh22280.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-22280: goto to label before try/finally after try/catch +--FILE-- + +--EXPECT-- +try +finally +done diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 7a364dfccbcd..317f68b486bb 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -684,6 +684,10 @@ static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num int i; for (i = 0; i < op_array->last_try_catch; i++) { + if (!op_array->try_catch_array[i].finally_op) { + continue; + } + if ((op_num < op_array->try_catch_array[i].finally_op || op_num >= op_array->try_catch_array[i].finally_end) && (dst_num >= op_array->try_catch_array[i].finally_op &&