xref: /PHP-7.3/Zend/tests/bug69989_2.phpt (revision f75be353)
1--TEST--
2Collection of some cycles on unfinished generators
3--FILE--
4<?php
5
6// CV
7function gen1() {
8    $gen = yield;
9    yield;
10}
11
12$gen = gen1();
13$gen->send($gen);
14
15// This
16class Test {
17    public $gen;
18    public function gen2() {
19        yield;
20    }
21}
22
23$test = new Test;
24$test->gen = $test->gen2();
25
26// Closure object
27$gen3 = (function() use (&$gen3) {
28    yield;
29})();
30
31// Yield from array
32function gen4() {
33    yield from [yield];
34}
35
36$gen = gen4();
37$gen->send($gen);
38
39?>
40===DONE===
41--EXPECT--
42===DONE===
43