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
38 additions
and
0 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,35 @@ | ||
--TEST-- | ||
GH-14387 (Crash when stack walking in destructor of yielded from values during Generator->throw()) | ||
--FILE-- | ||
<?php | ||
|
||
function prime(Generator $generator) { | ||
$generator->valid(); | ||
} | ||
|
||
$g = (function () { | ||
yield from [null, new class { | ||
function __destruct() { | ||
// Trigger a stack walk, hitting a bad frame. | ||
throw new Exception; | ||
} | ||
}]; | ||
})(); | ||
|
||
prime($g); | ||
|
||
$g->throw(new Error); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught Error in %s:%d | ||
Stack trace: | ||
#0 {main} | ||
|
||
Next Exception in %s:%d | ||
Stack trace: | ||
#0 %s(%d): class@anonymous->__destruct() | ||
#1 [internal function]: {%s}() | ||
#2 %s(%d): Generator->throw(Object(Error)) | ||
#3 {main} | ||
thrown in %s on line %d |
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