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