2021-12-03 10:40:17 +00:00
|
|
|
--TEST--
|
|
|
|
Array object clobbering by user error handler
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2021-12-13 11:59:30 +00:00
|
|
|
class A implements ArrayAccess {
|
2021-12-13 12:20:16 +00:00
|
|
|
public function &offsetGet($n): mixed {
|
|
|
|
return null;
|
2021-12-13 11:59:30 +00:00
|
|
|
}
|
2021-12-13 12:20:16 +00:00
|
|
|
public function offsetSet($n, $v): void {
|
2021-12-13 11:59:30 +00:00
|
|
|
}
|
2021-12-13 12:20:16 +00:00
|
|
|
public function offsetUnset($n): void {
|
2021-12-13 11:59:30 +00:00
|
|
|
}
|
2021-12-13 12:20:16 +00:00
|
|
|
public function offsetExists($n): bool {
|
|
|
|
return false;
|
2021-12-13 11:59:30 +00:00
|
|
|
}
|
2021-12-03 10:40:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_error_handler(function () {
|
|
|
|
$GLOBALS['a'] = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
$a = new A;
|
|
|
|
$a[$c] = 'x' ;
|
|
|
|
var_dump($a);
|
|
|
|
|
|
|
|
$a = new A;
|
|
|
|
$a[$c] .= 'x' ;
|
|
|
|
var_dump($a);
|
|
|
|
|
|
|
|
$a = new A;
|
|
|
|
$a[$c][$c] = 'x' ;
|
|
|
|
var_dump($a);
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
NULL
|
|
|
|
NULL
|
|
|
|
NULL
|