xref: /PHP-8.1/Zend/tests/bug76946.phpt (revision 83e2b9e2)
1--TEST--
2Bug #76946: Cyclic reference in generator not detected
3--FILE--
4<?php
5
6function gen() {
7    $gen = yield;
8    foreach ([1, $gen] as $v) {
9        yield $v;
10    }
11}
12
13function gen2() {
14    $gen = yield;
15    $gen + yield;
16}
17
18$gen = gen();
19$gen->send($gen);
20
21$gen2 = gen2();
22$gen2->send($gen2);
23
24?>
25===DONE===
26--EXPECT--
27===DONE===
28