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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dflorent dot pokap at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Dec 21 11:01:30 2024 UTC