xref: /PHP-8.1/Zend/tests/generators/bug78434.phpt (revision 823a9568)
1--TEST--
2Bug #78434: Generator skips first item after valid() call
3--FILE--
4<?php
5
6$function = function () {
7    yield 0;
8};
9
10$wrapper = function () use ($function) {
11    $generator = $function();
12    $generator->valid();
13    yield from $generator;
14
15    $generator = $function();
16    $generator->valid();
17    yield from $generator;
18};
19
20foreach ($wrapper() as $value) {
21    echo $value, "\n";
22}
23
24?>
25--EXPECT--
260
270
28