xref: /php-src/Zend/tests/objects_034.phpt (revision 76075823)
1--TEST--
2Array object clobbering by user error handler
3--FILE--
4<?php
5class A implements ArrayAccess {
6    public function &offsetGet($n): mixed {
7    	return null;
8    }
9    public function offsetSet($n, $v): void {
10    }
11    public function offsetUnset($n): void {
12    }
13    public function offsetExists($n): bool {
14    	return false;
15    }
16}
17
18set_error_handler(function () {
19    $GLOBALS['a'] = null;
20});
21
22$a = new A;
23$a[$c] = 'x' ;
24var_dump($a);
25
26$a = new A;
27$a[$c] .= 'x' ;
28var_dump($a);
29
30$a = new A;
31$a[$c][$c] = 'x' ;
32var_dump($a);
33?>
34--EXPECT--
35NULL
36NULL
37NULL
38