|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-04-09 11:25 UTC] jani@php.net
[2008-04-09 11:47 UTC] kudung at gmx dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 18:00:01 2025 UTC |
Description: ------------ Hi, just discovered that an parameter wich passed to an function as an non reference of type object is handeld as an reference, but if i pass a parameter of type array to the function it is handled as a copie as it should be. Reproduce code: --------------- class foob { function testbar( $das ) { unset( $das->ding ); } } function testbar( $das ) { unset( $das->ding ); } $ers = new stdClass(); $ers->ding = '323'; testbar($ers); var_dump( $ers ); $ers2 = new stdClass(); $ers2->ding = '323'; $foob = new foob(); $foob->testbar($ers2); var_dump( $ers2 ); Expected result: ---------------- Expected that properties still exists: object(stdClass)#1 (1) { ["ding"]=> string(3) "323" } object(stdClass)#2 (1) { ["ding"]=> string(3) "323" } Actual result: -------------- Output: object(stdClass)#1 (0) { } object(stdClass)#2 (0) { }