1--TEST--
2GC on running generator
3--FILE--
4<?php
5
6function gen() {
7    yield;
8    // Trigger GC while $v is being reassigned.
9    $ary = [new stdClass, new stdClass, new stdClass];
10    $ary[0]->foo = $ary;
11    foreach ($ary as &$v) { }
12}
13
14for ($i = 0; $i < 10000; $i++) {
15    // Make sure gen is registered as a GC root.
16    $gen = gen();
17    $gen2 = $gen;
18    unset($gen);
19    foreach ($gen2 as $v) {}
20}
21
22?>
23===DONE===
24--EXPECT--
25===DONE===
26