File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #74606 (Segfault within try/catch/finally nesting in Generators)
3
+ --FILE--
4
+ <?php
5
+
6
+ function gen () {
7
+ $ array = ["foo " ];
8
+ $ array [] = "bar " ;
9
+
10
+ foreach ($ array as $ item ) {
11
+ try {
12
+ try {
13
+ yield ;
14
+ } finally {
15
+ echo "fin $ item \n" ;
16
+ }
17
+ } catch (\Exception $ e ) {
18
+ echo "catch \n" ;
19
+ continue ;
20
+ }
21
+ }
22
+ }
23
+ gen ()->throw (new Exception );
24
+
25
+ ?>
26
+ --EXPECT--
27
+ fin foo
28
+ catch
29
+ fin bar
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ static void zend_generator_cleanup_unfinished_execution(
108
108
if (UNEXPECTED (generator -> frozen_call_stack )) {
109
109
zend_generator_restore_call_stack (generator );
110
110
}
111
- zend_cleanup_unfinished_execution (execute_data , op_num , 0 );
111
+ zend_cleanup_unfinished_execution (execute_data , op_num , catch_op_num );
112
112
}
113
113
}
114
114
/* }}} */
You can’t perform that action at this time.
0 commit comments