summaryrefslogtreecommitdiff
path: root/ext/spl/tests/bug64264.phpt
blob: e7b695bd82fe8739f0286aeb4abebfcbba1aa523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
Bug #64264 (SPLFixedArray toArray problem)
--FILE--
<?php
class MyFixedArray extends \SplFixedArray {                                                                                                                                 
    protected $foo;                                                                                                                                                         
    protected $bar;                                                                                                                                                         
}                                                                                                                                                                           

$myFixedArr = new MyFixedArray(1);                                                                                                                                          
$myFixedArr[0] = 'foo';
$myFixedArr->setSize(2);
$myFixedArr[1] = 'bar';
$myFixedArr->setSize(5);
$array = $myFixedArr->toArray();
$array[2] = "ERROR";
$array[3] = "ERROR";
$array[4] = "ERROR";
unset($array[4]);
$myFixedArr->setSize(2);

print_r($myFixedArr->toArray());
?>
--EXPECTF--
Array
(
    [0] => foo
    [1] => bar
)