Bug #65019 [Nab]: SplFixedArray: Notice with array push

From: Date: Thu, 27 Mar 2014 14:43:56 +0000
Subject: Bug #65019 [Nab]: SplFixedArray: Notice with array push
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184933@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65019&edit=1

 ID:                 65019
 Updated by:         levim@php.net
 Reported by:        dflorent dot pokap at gmail dot com
 Summary:            SplFixedArray: Notice with array push
 Status:             Not a bug
 Type:               Bug
 Package:            SPL related
 Operating System:   Linux 3.5.0-17-generic
-PHP Version:        5.4+
+PHP Version:        5.3+
 Assigned To:        levim
 Block user comment: N
 Private report:     N

 New Comment:

Also, you could use an object instead of an array; it would just need to implement ArrayAccess and
it should work.


Previous Comments:
------------------------------------------------------------------------
[2014-03-27 00:25:49] 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).

------------------------------------------------------------------------
[2013-06-12 18:07:21] 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


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65019&edit=1


Thread (3 messages)

« previous php.bugs (#184933) next »