Merge branch 'PHP-7.4'

* PHP-7.4:
  Fixed bug #79657
This commit is contained in:
Nikita Popov 2020-06-08 11:32:24 +02:00
commit 57f408e87c
2 changed files with 43 additions and 0 deletions

42
Zend/tests/bug79657.phpt Normal file
View file

@ -0,0 +1,42 @@
--TEST--
Bug #79657: "yield from" hangs when invalid value encountered
--FILE--
<?php
function throwException(): iterable
{
throw new Exception();
}
function loop(): iterable
{
$callbacks = [
function () {
yield 'first';
},
function () {
yield from throwException();
}
];
foreach ($callbacks as $callback) {
yield from $callback();
}
}
function get(string $first, int $second): array
{
return [];
}
get(...loop());
?>
--EXPECTF--
Fatal error: Uncaught Exception in %s:%d
Stack trace:
#0 %s(%d): throwException()
#1 %s(%d): {closure}()
#2 %s(%d): loop()
#3 {main}
thrown in %s on line %d

View file

@ -794,6 +794,7 @@ try_again:
} else {
generator = zend_generator_get_current(orig_generator);
zend_generator_throw_exception(generator, NULL);
orig_generator->flags &= ~ZEND_GENERATOR_DO_INIT;
goto try_again;
}
}