|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65019 SplFixedArray: Notice with array push
Submitted: 2013-06-12 18:07 UTC Modified: 2014-03-27 14:43 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dflorent dot pokap at gmail dot com Assigned: levim (profile)
Status: Not a bug Package: SPL related
PHP Version: 5.3+ OS: Linux 3.5.0-17-generic
Private report: No CVE-ID: None
 [2013-06-12 18:07 UTC] dflorent dot pokap at gmail dot com
When I want to push an element in an array item of SplFixedArray, I get an error 
Tested on 5.4.6-1ubuntu1.2.

Test script:
$a = new SplFixedArray(1);
$a[0] = array();

array_push($a[0], 'test');

Actual result:
Notice: Indirect modification of overloaded element of SplFixedArray has no 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-27 00:25 UTC]
-Status: Open +Status: Not a bug -PHP Version: 5.4.16 +PHP Version: 5.4+ -Assigned To: +Assigned To: levim
 [2014-03-27 00:25 UTC]
Basically it's doing a push to a copy of the object; you would need to work with references which SplFixedArray doesn't support (and I don't think we should add).
 [2014-03-27 14:43 UTC]
-PHP Version: 5.4+ +PHP Version: 5.3+
 [2014-03-27 14:43 UTC]
Also, you could use an object instead of an array; it would just need to implement ArrayAccess and it should work.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 21:01:28 2024 UTC