mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fix throwing of yield from related exceptions into generator
Use the general zend_generator_throw_exception() helper for this.
Otherwise we don't handle the off-by-one opline correctly (should
we maybe just stop doing that?)
This is a followup to ad750c3bb6
,
which fixed a different yield from exception handling problem that
happened to show up in the same test case from oss-fuzz #25321.
Now both issues should be fixed.
This commit is contained in:
parent
a07c1f56aa
commit
2e9e706a82
@ -15,7 +15,8 @@ class FooBar implements Iterator {
|
|||||||
|
|
||||||
function gen() {
|
function gen() {
|
||||||
try {
|
try {
|
||||||
yield from new FooBar;
|
// the fact that the yield from result is used is relevant.
|
||||||
|
var_dump(yield from new FooBar);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo $e->getMessage(), "\n";
|
echo $e->getMessage(), "\n";
|
||||||
}
|
}
|
||||||
|
@ -740,7 +740,7 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
exception:
|
exception:
|
||||||
zend_rethrow_exception(generator->execute_data);
|
zend_generator_throw_exception(generator, NULL);
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
zval_ptr_dtor(&generator->values);
|
zval_ptr_dtor(&generator->values);
|
||||||
|
Loading…
Reference in New Issue
Block a user