forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--TEST-- | ||
Bug #74954 (crash after update of generator yielding from finished generator) | ||
--FILE-- | ||
<?php | ||
|
||
function from() { | ||
yield 1; | ||
throw new Exception(); | ||
} | ||
|
||
function gen($gen) { | ||
try { | ||
var_dump(yield from $gen); | ||
} catch (Exception $e) { print "Caught exception!\n$e\n"; } | ||
} | ||
|
||
$gen = from(); | ||
$gens[] = gen($gen); | ||
$gens[] = gen($gen); | ||
|
||
foreach ($gens as $g) { | ||
$g->current(); | ||
} | ||
|
||
do { | ||
foreach ($gens as $i => $g) { | ||
$g->next(); | ||
} | ||
} while($gens[0]->valid()); | ||
|
||
?> | ||
--EXPECTF-- | ||
Caught exception! | ||
Exception in %s:%d | ||
Stack trace: | ||
#0 %s(%d): from() | ||
#1 [internal function]: gen(Object(Generator)) | ||
#2 %s(%d): Generator->next() | ||
#3 {main} | ||
Caught exception! | ||
ClosedGeneratorException: Generator yielded from aborted, no return value available in %s:%d | ||
Stack trace: | ||
#0 [internal function]: gen(Object(Generator)) | ||
#1 %s(%d): Generator->next() | ||
#2 {main} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters