xref: /PHP-8.1/Zend/tests/generators/bug71297.phpt (revision f8d79582)
1--TEST--
2Bug #71297 (Memory leak with consecutive yield from)
3--FILE--
4<?php
5
6function foo() {
7    yield array_fill(0, 10000, 4);
8}
9
10function genLeak() {
11    $i = 0;
12    while (1) {
13        yield from foo();
14        print $i++;
15    }
16}
17
18$x = 0;
19foreach (genLeak() as $i) {
20    if ($x++ == 3) break;
21}
22
23?>
24--EXPECT--
25012
26