summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/bug70965.phpt
blob: 4ed34fd640710a5953949454586e68d31c4109eb (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
28
29
30
31
32
--TEST--
Bug #70965 (yield from with a common iterator primes too much)
--FILE--
<?php

function it() {
    yield from [1, 2, 3, 4, 5];
}

function bar($g) {
    yield from $g;
}

$gen = it();
$gens[] = bar($gen);
$gens[] = bar($gen);

do {
    foreach($gens as $g) {
        var_dump($g->current());
        $gen->next();
    }
} while ($gen->valid());

?>
--EXPECT--
int(1)
int(2)
int(3)
int(4)
int(5)
int(5)