php-8.0.30-src/Zend/tests/generators/bug78434.phpt

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