1
0
mirror of https://github.com/php/php-src.git synced 2026-04-19 22:11:12 +02:00
Files
archived-php-src/Zend/tests/generators/bug78434.phpt
Nikita Popov 823a956855 Fixed bug #78434
The DO_INIT flag, which will skip the first resume on a primed
generator, should always be set when starting to yield from a
new generator, not only when the yield from happens during priming.
2020-04-09 10:33:11 +02:00

28 lines
413 B
PHP

--TEST--
Bug #78434: Generator skips first item after valid() call
--FILE--
<?php
$function = function () {
yield 0;
};
$wrapper = function () use ($function) {
$generator = $function();
$generator->valid();
yield from $generator;
$generator = $function();
$generator->valid();
yield from $generator;
};
foreach ($wrapper() as $value) {
echo $value, "\n";
}
?>
--EXPECT--
0
0