#37225 [Bgs->Opn]: tangled references

From: Date: Thu, 24 Aug 2006 15:02:30 +0000
Subject: #37225 [Bgs->Opn]: tangled references
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101281@lists.php.net to get a copy of this message
ID: 37225 User updated by: max at hightech dot lv Reported By: max at hightech dot lv -Status: Bogus +Status: Open Bug Type: Scripting Engine problem Operating System: ALL PHP Version: 5.1.2 Assigned To: dmitry New Comment: But why after the second line "$arr" is references? I don't define it as references! Previous Comments: ------------------------------------------------------------------------ [2006-08-24 14:56:04] tony2001@php.net Duplicate of #37917. You're copying and modifying refernces and this is expected. ------------------------------------------------------------------------ [2006-04-27 16:07:28] max at hightech dot lv Description: ------------ looks like after copy reference to some variable, source-variable start to be reference it self. Is it correct? In result we can't make copy array, if some of it element was used as reference. Reproduce code: --------------- $arr = array("TEXT" => "test"); $tmp =& $arr["TEXT"]; $zz = $arr; $zz["TEXT"] = 1; var_dump($arr); Expected result: ---------------- array(1) { ["TEXT"]=> string(4) "test" } Actual result: -------------- array(1) { ["TEXT"]=> &int(1) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37225&edit=1

« previous php.bugs (#101281) next »