-
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 inc/dec of undef var with error handler
Set the variable to null after emitting the undef var notice rather than before. This avoids an assertion failure if the var is unset by the error handler. The flip side is that this may cause a leak instead, but that's the more harmless outcome. Fixes oss-fuzz #36604.
- Loading branch information
Showing
5 changed files
with
39 additions
and
14 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,25 @@ | ||
--TEST-- | ||
Inc/dec undef var with error handler | ||
--FILE-- | ||
<?php | ||
set_error_handler(function($_, $m) { | ||
echo "$m\n"; | ||
unset($GLOBALS['x']); | ||
}); | ||
var_dump($x--); | ||
unset($x); | ||
var_dump($x++); | ||
unset($x); | ||
var_dump(--$x); | ||
unset($x); | ||
var_dump(++$x); | ||
?> | ||
--EXPECT-- | ||
Undefined variable $x | ||
NULL | ||
Undefined variable $x | ||
NULL | ||
Undefined variable $x | ||
NULL | ||
Undefined variable $x | ||
int(1) |
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
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