xref: /PHP-7.0/Zend/tests/bug69955.phpt (revision 1f6d27d3)
1--TEST--
2Bug #69955 (Segfault when trying to combine [] and assign-op on ArrayAccess object).
3--FILE--
4<?php
5class C10 implements ArrayAccess
6{
7        function offsetExists($offset)
8        {
9                echo "\nInside " . __METHOD__ . "\n"; var_dump($offset);
10        }
11        function offsetGet($offset)
12        {
13                echo "\nInside " . __METHOD__ . "\n"; var_dump($offset); return 100;
14        }
15        function offsetSet($offset, $value)
16        {
17                echo "\nInside " . __METHOD__ . "\n"; var_dump($offset); var_dump($value);
18        }
19        function offsetUnset($offset)
20        {
21                echo "\nInside " . __METHOD__ . "\n"; var_dump($offset);
22        }
23}
24
25$c10 = new C10;
26
27var_dump($c10[] += 5);
28--EXPECTF--
29Inside C10::offsetGet
30NULL
31
32Inside C10::offsetSet
33NULL
34int(105)
35int(105)
36