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