xref: /php-src/Zend/tests/bug75420.16.phpt (revision 75a678a7)
1--TEST--
2Bug #75420.16 (Indirect modification of magic method argument)
3--FILE--
4<?php
5class Test implements ArrayAccess {
6    public function offsetExists($x): bool { }
7    public function offsetGet($x): mixed { }
8    public function offsetSet($x, $y): void { $GLOBALS["obj"] = 24; var_dump($this); }
9    public function offsetUnset($x): void { }
10}
11
12$obj = new Test;
13$name = "foo";
14$obj[$name] = 1;
15var_dump($obj);
16?>
17--EXPECT--
18object(Test)#1 (0) {
19}
20int(24)
21