xref: /PHP-7.1/Zend/tests/bug68896.phpt (revision 371dc9b6)
1--TEST--
2Bug #68896 (Changing ArrayObject value cause Segment Fault)
3--FILE--
4<?php
5class A implements ArrayAccess {
6	private $a = [];
7	function offsetGet($offset) {
8		return $this->a[$offset];
9	}
10        function offsetSet($offset, $value) {
11                $this->a[$offset] = $value;
12        }
13        function offsetExists($offset) {
14                isset($this->a[$offset]);
15        }
16        function offsetUnset($offset) {
17                unset($this->a[$offset]);
18        }
19}
20
21$obj = new ArrayObject(["a" => 1]);
22$obj["a"] .= "test";
23var_dump($obj["a"]);
24
25$obj = new A;
26$obj["a"] = 1;
27$obj["a"] .= "test";
28var_dump($obj["a"]);
29--EXPECT--
30string(5) "1test"
31string(5) "1test"
32