-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not run finally blocks in generators on unclean shutdown (e.g. caused by exit). This is consistent with how finally blocks outside of generators behave.
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
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,22 @@ | ||
--TEST-- | ||
Bug #75396: Exit inside generator finally results in fatal error | ||
--FILE-- | ||
<?php | ||
|
||
$gen = (function () { | ||
yield 42; | ||
|
||
try { | ||
echo "Try\n"; | ||
exit("Exit\n"); | ||
} finally { | ||
echo "Finally\n"; | ||
} | ||
})(); | ||
|
||
$gen->send("x"); | ||
|
||
?> | ||
--EXPECT-- | ||
Try | ||
Exit |
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