Throwing an exception should count as an initialization for this
purpose.
. Fixed bug #79650 (php-win.exe 100% cpu lockup). (cmb)
. Fixed bug #79668 (get_defined_functions(true) may miss functions). (cmb,
Nikita)
+ . Fixed bug #79657 ("yield from" hangs when invalid value encountered).
+ (Nikita)
- Filter:
. Fixed bug #73527 (Invalid memory access in php_filter_strip). (cmb)
--- /dev/null
+--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
} else {
generator = zend_generator_get_current(orig_generator);
zend_generator_throw_exception(generator, NULL);
+ orig_generator->flags &= ~ZEND_GENERATOR_DO_INIT;
goto try_again;
}
}