|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-06 22:12 UTC] sniper@php.net
[2005-03-07 11:50 UTC] stefan at hotpaenz dot de
[2005-03-07 12:13 UTC] stefan at hotpaenz dot de
[2005-03-07 12:49 UTC] derick@php.net
[2005-06-07 11:58 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ See the code below: An object of ClassA is passed to FuncB, which calls FuncA with the return-by-reference operator. FuncA is not designed to return by reference. The reference count seems to get wrong by doing that so the object is discarded when FuncB returns. Reproduce code: --------------- <?php class ClassA { } function FuncA($obj) { return $obj; } function FuncB($obj) { $dummy = &FuncA($obj); } $obj = new ClassA(); FuncB($obj); $str='This is a string' var_dump($obj); Expected result: ---------------- object(ClassA)#1 (0) { } Actual result: -------------- string(16) "This is a string"