xref: /PHP-8.3/Zend/tests/bug68896.phpt (revision 75a678a7)
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): mixed {
8        return $this->a[$offset];
9    }
10        function offsetSet($offset, $value): void {
11                $this->a[$offset] = $value;
12        }
13        function offsetExists($offset): bool {
14                isset($this->a[$offset]);
15        }
16        function offsetUnset($offset): void {
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?>
30--EXPECT--
31string(5) "1test"
32string(5) "1test"
33