xref: /PHP-7.0/Zend/tests/generators/bug70965.phpt (revision 73a92964)
1--TEST--
2Bug #70965 (yield from with a common iterator primes too much)
3--FILE--
4<?php
5
6function it() {
7    yield from [1, 2, 3, 4, 5];
8}
9
10function bar($g) {
11    yield from $g;
12}
13
14$gen = it();
15$gens[] = bar($gen);
16$gens[] = bar($gen);
17
18do {
19    foreach($gens as $g) {
20        var_dump($g->current());
21        $gen->next();
22    }
23} while ($gen->valid());
24
25?>
26--EXPECT--
27int(1)
28int(2)
29int(3)
30int(4)
31int(5)
32int(5)
33