mirror of
https://github.com/php/php-src.git
synced 2024-12-16 21:37:49 +08:00
22b6aac66f
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.
26 lines
366 B
PHP
26 lines
366 B
PHP
--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)
|