-
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.
Handle ref return from Iterator::key()
Handle this in the implementation of get_current_key of user_it, so that the callers may assume that the key is not a reference. Fixes oss-fuzz #33018.
- Loading branch information
Showing
2 changed files
with
18 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,15 @@ | ||
--TEST-- | ||
Iterator::key() with by-ref return | ||
--FILE-- | ||
<?php | ||
class Test extends ArrayIterator { | ||
function &key() { | ||
return $foo; | ||
} | ||
} | ||
foreach (new Test([0]) as $k => $v) { | ||
var_dump($k); | ||
} | ||
?> | ||
--EXPECT-- | ||
NULL |
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