PHP :: Bug #64264 :: SPLFixedArray toArray problem
[2013-02-21 13:09 UTC] kwreczycki at gmail dot com
Description:
------------
Be aware if You extends SplFixedArray and use toArray method.
Test script:
---------------
class MyFixedArray extends \SplFixedArray {
protected $foo;
protected $bar;
}
$myFixedArr = new MyFixedArray(1);
$myFixedArray[] = 'foo';
Expected result:
----------------
array(1) {
[0]=>
NULL
}
Actual result:
--------------
array(3) {
["*foo"]=>
NULL
["*bar"]=>
NULL
[0]=>
NULL
}
*foo and *bar keys, can invoke troubles in some situations if You expects array
without properties from inherited class. Method toArray should return values only
for elements which are added to collection without properties inherited from
class.
[2013-02-24 05:03 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
[2013-02-24 10:36 UTC] kwreczycki at gmail dot com