1--TEST--
2Generator GC triggered with live iterator in foreach
3--FILE--
4<?php
5
6function gen($iter, &$gen) {
7    foreach ($iter as $v) {
8        yield;
9    }
10}
11
12$iter = new ArrayIterator([1, 2, 3]);
13$gen = gen($iter, $gen);
14$gen->next();
15unset($gen);
16gc_collect_cycles();
17
18?>
19===DONE===
20--EXPECT--
21===DONE===
22