php.net |  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
Votes:2
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 + 33 = ?
Subscribe to this entry?

 
 [2013-06-12 18:07 UTC] dflorent dot pokap at gmail dot com
Description:
------------
When I want to push an element in an array item of SplFixedArray, I get an error 
notice.
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 
effect

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-27 00:25 UTC] levim@php.net
-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] levim@php.net
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] levim@php.net
-PHP Version: 5.4+ +PHP Version: 5.3+
 [2014-03-27 14:43 UTC] levim@php.net
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: Thu Apr 25 15:01:30 2024 UTC