Skip to content

Commit c6fd37c

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix throwing of yield from related exceptions into generator
2 parents 605ee9c + 2e9e706 commit c6fd37c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Zend/tests/generators/yield_from_valid_exception.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class FooBar implements Iterator {
1515

1616
function gen() {
1717
try {
18-
yield from new FooBar;
18+
// the fact that the yield from result is used is relevant.
19+
var_dump(yield from new FooBar);
1920
} catch (Exception $e) {
2021
echo $e->getMessage(), "\n";
2122
}

Zend/zend_generators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
759759
return SUCCESS;
760760

761761
exception:
762-
zend_rethrow_exception(generator->execute_data);
762+
zend_generator_throw_exception(generator, NULL);
763763

764764
failure:
765765
zval_ptr_dtor(&generator->values);

0 commit comments

Comments
 (0)