File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 77 with dynamic class const lookup default argument). (ilutov)
88 . Fixed bug GH-20695 (Assertion failure in normalize_value() when parsing
99 malformed INI input via parse_ini_string()). (ndossche)
10+ . Fixed bug GH-20714 (Uncatchable exception thrown in generator). (ilutov)
1011
1112- EXIF:
1213 . Fixed bug GH-20631 (Integer underflow in exif HEIF parsing
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20714: Uncatchable exception thrown in generator
3+ --CREDITS--
4+ Grégoire Paris (greg0ire)
5+ --FILE--
6+ <?php
7+
8+ function gen (): Generator {
9+ try {
10+ yield 1 ;
11+ } finally {}
12+ }
13+
14+ function process (): void {
15+ $ g = gen ();
16+ foreach ($ g as $ _ ) {
17+ throw new Exception ('ERROR ' );
18+ }
19+ }
20+
21+ try {
22+ process ();
23+ } catch (Exception $ e ) {
24+ echo "Caught \n" ;
25+ }
26+
27+ ?>
28+ --EXPECT--
29+ Caught
Original file line number Diff line number Diff line change @@ -313,7 +313,9 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
313313 zend_object * old_exception = NULL ;
314314 const zend_op * old_opline_before_exception = NULL ;
315315 if (EG (exception )) {
316- if (EG (current_execute_data )) {
316+ if (EG (current_execute_data )
317+ && EG (current_execute_data )-> opline
318+ && EG (current_execute_data )-> opline -> opcode == ZEND_HANDLE_EXCEPTION ) {
317319 EG (current_execute_data )-> opline = EG (opline_before_exception );
318320 old_opline_before_exception = EG (opline_before_exception );
319321 }
@@ -330,7 +332,7 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
330332 zend_generator_resume (generator );
331333
332334 if (old_exception ) {
333- if (EG ( current_execute_data ) ) {
335+ if (old_opline_before_exception ) {
334336 EG (current_execute_data )-> opline = EG (exception_op );
335337 EG (opline_before_exception ) = old_opline_before_exception ;
336338 }
You can’t perform that action at this time.
0 commit comments