xref: /PHP-7.1/Zend/tests/bug69989_3.phpt (revision c0c73f70)
1--TEST--
2Generator cycle collection edge cases
3--FILE--
4<?php
5
6// Extra args
7function gen1() {
8    yield;
9}
10$obj = new stdClass;
11$obj->gen = gen1($obj);
12
13// Symtable
14function gen2() {
15    $varName = 'a';
16    $$varName = yield;
17    yield;
18}
19$gen = gen2();
20$gen->send($gen);
21
22// Symtable indirect
23function gen3() {
24    $varName = 'a';
25    $$varName = 42;
26    $var = yield;
27    yield;
28}
29$gen = gen3();
30$gen->send($gen);
31
32// Yield from root
33function gen4() {
34    yield from yield;
35}
36$gen = gen4();
37$gen2 = gen4($gen);
38$gen2->send([1, 2, 3]);
39$gen->send($gen2);
40
41?>
42===DONE===
43--EXPECT--
44===DONE===
45