#34518 [Opn->Asn]: copy-on-write error

From: Date: Fri, 16 Sep 2005 08:09:22 +0000
Subject: #34518 [Opn->Asn]: copy-on-write error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85139@lists.php.net to get a copy of this message
ID: 34518 Updated by: sniper@php.net Reported By: genome at digitaljunkies dot ca -Status: Open +Status: Assigned Bug Type: Arrays related -Operating System: Linux +Operating System: * -PHP Version: 5.1.0RC1 +PHP Version: 5CVS-2005-09-15 -Assigned To: +Assigned To: dmitry New Comment: Dmitry, I think it was you who fixed the problem in bug #27381, can you check this one out? Previous Comments: ------------------------------------------------------------------------ [2005-09-16 00:02:30] genome at digitaljunkies dot ca Description: ------------ Altering a subindex of a copy of an array alters the original array as well. Similar to bug#27381. Altering a root index does not exhibit this behaviour. Reproduce code: --------------- <?php $arr = array(1,2,3); $arr["foo"] = array(4,5,6); $copy = $arr; unset($copy["foo"][0]); print_r($arr); ?> Expected result: ---------------- Array ( [0] => 1 [1] => 2 [2] => 3 [foo] => Array ( [0] => 4 [1] => 5 [2] => 6 ) ) Actual result: -------------- Array ( [0] => 1 [1] => 2 [2] => 3 [foo] => Array ( [1] => 5 [2] => 6 ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34518&edit=1

« previous php.bugs (#85139) next »