1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 10:16:41 +02:00

Fixed bug #70904 (yield from incorrectly marks valid generator as finished)

This commit is contained in:
Bob Weinand
2015-11-24 23:43:34 +01:00
parent 569763cb1a
commit 80d9dcafe0
4 changed files with 61 additions and 18 deletions
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Bug #70904 (yield from incorrectly marks valid generator as finished)
--FILE--
<?php
function g1() {
yield 1;
}
function g2($g1) {
yield from $g1;
echo "reached!\n";
yield 2;
}
$g1 = g1();
$g2 = g2($g1);
var_dump($g2->valid());
var_dump($g2->current());
$g1->next();
var_dump($g1->valid());
var_dump($g2->valid());
var_dump($g2->current());
$g2->next();
var_dump($g2->valid());
var_dump($g2->current());
$g2->next();
var_dump($g2->valid());
var_dump($g2->current());
?>
--EXPECT--
bool(true)
int(1)
bool(false)
bool(true)
int(1)
reached!
bool(true)
int(2)
bool(false)
NULL
@@ -37,5 +37,8 @@ int(4)
int(6)
int(3)
int(5)
int(3)
int(5)
NULL
bool(false)