File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Try finally (segfault with empty break)
3
+ --FILE--
4
+ <?php
5
+ function foo () {
6
+ try {
7
+ break ;
8
+ } finally {
9
+ }
10
+ }
11
+
12
+ foo ();
13
+ ?>
14
+ --EXPECTF--
15
+ Fatal error: Cannot break/continue 1 level in %stry_finally_011.php on line %d
Original file line number Diff line number Diff line change @@ -643,15 +643,16 @@ static void zend_resolve_finally_calls(zend_op_array *op_array TSRMLS_DC)
643
643
zend_brk_cont_element * jmp_to ;
644
644
645
645
nest_levels = Z_LVAL (op_array -> literals [opline -> op2 .constant ].constant );
646
- array_offset = opline -> op1 .opline_num ;
647
- do {
648
- jmp_to = & op_array -> brk_cont_array [array_offset ];
649
- if (nest_levels > 1 ) {
650
- array_offset = jmp_to -> parent ;
651
- }
652
- } while (-- nest_levels > 0 );
653
- zend_resolve_finally_call (op_array , i , opline -> opcode == ZEND_BRK ? jmp_to -> brk : jmp_to -> cont TSRMLS_CC );
654
- break ;
646
+ if ((array_offset = opline -> op1 .opline_num ) != -1 ) {
647
+ do {
648
+ jmp_to = & op_array -> brk_cont_array [array_offset ];
649
+ if (nest_levels > 1 ) {
650
+ array_offset = jmp_to -> parent ;
651
+ }
652
+ } while (-- nest_levels > 0 );
653
+ zend_resolve_finally_call (op_array , i , opline -> opcode == ZEND_BRK ? jmp_to -> brk : jmp_to -> cont TSRMLS_CC );
654
+ break ;
655
+ }
655
656
}
656
657
case ZEND_GOTO :
657
658
if (Z_TYPE (op_array -> literals [opline -> op2 .constant ].constant ) != IS_LONG ) {
You can’t perform that action at this time.
0 commit comments