xref: /PHP-7.4/ext/spl/tests/bug64264.phpt (revision 782352c5)
1--TEST--
2Bug #64264 (SPLFixedArray toArray problem)
3--FILE--
4<?php
5class MyFixedArray extends \SplFixedArray {
6    protected $foo;
7    protected $bar;
8}
9
10$myFixedArr = new MyFixedArray(1);
11$myFixedArr[0] = 'foo';
12$myFixedArr->setSize(2);
13$myFixedArr[1] = 'bar';
14$myFixedArr->setSize(5);
15$array = $myFixedArr->toArray();
16$array[2] = "ERROR";
17$array[3] = "ERROR";
18$array[4] = "ERROR";
19unset($array[4]);
20$myFixedArr->setSize(2);
21
22print_r($myFixedArr->toArray());
23?>
24--EXPECT--
25Array
26(
27    [0] => foo
28    [1] => bar
29)
30