xref: /PHP-7.2/ext/spl/tests/bug54970.phpt (revision 47315dfd)
1--TEST--
2Bug #54970 (SplFixedArray::setSize() isn't resizing)
3--FILE--
4<?php
5
6$fa = new SplFixedArray(2);
7$fa[0] = 'Hello';
8$fa[1] = 'World';
9$fa->setSize(3);
10$fa[2] = '!';
11var_dump($fa);
12$fa->setSize(2);
13var_dump($fa);
14var_dump($fa->getSize());
15
16
17?>
18--EXPECTF--
19object(SplFixedArray)#%d (3) {
20  [0]=>
21  string(5) "Hello"
22  [1]=>
23  string(5) "World"
24  [2]=>
25  string(1) "!"
26}
27object(SplFixedArray)#%d (2) {
28  [0]=>
29  string(5) "Hello"
30  [1]=>
31  string(5) "World"
32}
33int(2)
34