php-src/Zend/tests/bug69989_3.phpt
Nikita Popov c0c73f7083 Fix bug #69989
This should cover all the basic cycles. Anything further would
require scanning the call stack and live temporaries.
2016-02-12 18:52:53 +01:00

45 lines
594 B
PHP

--TEST--
Generator cycle collection edge cases
--FILE--
<?php
// Extra args
function gen1() {
yield;
}
$obj = new stdClass;
$obj->gen = gen1($obj);
// Symtable
function gen2() {
$varName = 'a';
$$varName = yield;
yield;
}
$gen = gen2();
$gen->send($gen);
// Symtable indirect
function gen3() {
$varName = 'a';
$$varName = 42;
$var = yield;
yield;
}
$gen = gen3();
$gen->send($gen);
// Yield from root
function gen4() {
yield from yield;
}
$gen = gen4();
$gen2 = gen4($gen);
$gen2->send([1, 2, 3]);
$gen->send($gen2);
?>
===DONE===
--EXPECT--
===DONE===