|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-05-28 18:21 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2011-05-28 18:21 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Mar 16 02:00:01 2026 UTC |
Description: ------------ When assigning one array to another array that contains a collection of objects, the assignment is by reference. Test script: --------------- <?php $obj = (object) null; $obj->name = 'Joe'; $arrA = array($obj); $arrB = array(); $arrB = $arrA; $arrB[0]->name = 'Mary'; print_r($arrA); print_r($arrB); Expected result: ---------------- Array ( [0] => stdClass Object ( [name] => Joe ) ) Array ( [0] => stdClass Object ( [name] => Mary ) ) Actual result: -------------- Array ( [0] => stdClass Object ( [name] => Mary ) ) Array ( [0] => stdClass Object ( [name] => Mary ) )