#36941 [Asn]: ArrayIterator does not clone itself
ID: 36941
Updated by: helly@php.net
Reported By: ce at netage dot bg
Status: Assigned
Bug Type: SPL related
-Operating System: linux
+Operating System: *
PHP Version: 5.1.3RC2
Assigned To: helly
New Comment:
Fixed most of the issue in head but not like you expected to.
If you clone an ArrayIterator you also clone its reference thus the
described behavior below is correct.
If you clone an ArrayObject you clone the array, too. However the
behavior is not completely correct yet.
Previous Comments:
------------------------------------------------------------------------
[2006-04-01 21:17:04] tony2001@php.net
Marcus, could you plz look at it?
------------------------------------------------------------------------
[2006-04-01 16:29:25] ce at netage dot bg
Description:
------------
ArrayIterator does not clone itself
Reproduce code:
---------------
$a = new ArrayIterator();
$a[] = 1;
$b = clone $a;
var_dump($a[0], $b[0]);
$b[0] = $b[0] + 1;
var_dump($a[0], $b[0]);
Expected result:
----------------
int(1)
int(1)
int(1)
int(2)
Actual result:
--------------
int(1)
int(1)
int(2)
int(2)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36941&edit=1
Thread (4 messages)