summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/bug71297.phpt
blob: 5d63135928949652cd51324e5966fb2cd2cea7af (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
--TEST--
Bug #71297 (Memory leak with consecutive yield from)
--FILE--
<?php

function foo() {
    yield array_fill(0, 10000, 4);
}

function genLeak() {
    $i = 0;
    while (1) {
        yield from foo();
        print $i++;
    }
}

$x = 0;
foreach (genLeak() as $i) {
    if ($x++ == 3) break;
}

?>
--EXPECT--
012