Bug #64264 [Opn->Csd]: SPLFixedArray toArray problem
Edit report at https://bugs.php.net/bug.php?id=64264&edit=1
ID: 64264
Updated by: laruence@php.net
Reported by: kwreczycki at gmail dot com
Summary: SPLFixedArray toArray problem
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1b58bd39a637e9ec4ea9e95903b74aefdbd1b596
Log: Fixed bug #64264 (SPLFixedArray toArray problem)
Previous Comments:
------------------------------------------------------------------------
[2013-02-23 12:08:53] laruence@php.net
The following patch has been added/updated:
Patch Name: bug64264.phpt
Revision: 1361621333
URL: https://bugs.php.net/patch-display.php?bug=64264&patch=bug64264.phpt&revision=1361621333
------------------------------------------------------------------------
[2013-02-23 12:08:23] laruence@php.net
The following patch has been added/updated:
Patch Name: bug64264.patch
Revision: 1361621303
URL: https://bugs.php.net/patch-display.php?bug=64264&patch=bug64264.patch&revision=1361621303
------------------------------------------------------------------------
[2013-02-21 13:09:41] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64264&edit=1
Thread (7 messages)