summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/bug78434.phpt
blob: dd9351e1684a19a84bb7cfbe26a7f7901f1a37fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--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