From: stefan at hotpaenz dot de Operating system: Linux 2.6.3 PHP version: 5CVS-2004-07-28 (dev) PHP Bug Type: Zend Engine 2 problem Bug description: reference count gets wrong when return-reference-calling a normal function
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" -- Edit bug report at http://bugs.php.net/?id=29423&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29423&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29423&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29423&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29423&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29423&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29423&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29423&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29423&r=support Expected behavior: http://bugs.php.net/fix.php?id=29423&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29423&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29423&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29423&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29423&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29423&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29423&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29423&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29423&r=float