-
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.
Fix handling of exception if valid() during yield from
Fixes oss-fuzz #25296.
- Loading branch information
Showing
2 changed files
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Exception from valid() during yield from | ||
--FILE-- | ||
<?php | ||
|
||
class FooBar implements Iterator { | ||
function rewind() {} | ||
function current() {} | ||
function key() {} | ||
function next() {} | ||
function valid() { | ||
throw new Exception("Exception from valid()"); | ||
} | ||
} | ||
|
||
function gen() { | ||
try { | ||
yield from new FooBar; | ||
} catch (Exception $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
} | ||
|
||
$x = gen(); | ||
$x->current(); | ||
|
||
?> | ||
--EXPECT-- | ||
Exception from valid() |
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