ID:               39614
 Updated by:       [EMAIL PROTECTED]
 Reported By:      sailormax at inbox dot lv
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: any
 PHP Version:      5.2.0
 New Comment:

If you return by reference, you need to assign the returned value by
reference as well. This is also true for PHP 4.4.x, but not earlier
versions where this usage would create a memory corruption.


Previous Comments:
------------------------------------------------------------------------

[2006-11-24 09:55:39] sailormax at inbox dot lv

Description:
------------
PHP 4.x.x, returned value by reference, assign to variable reference.
But 5.x.x assign copy of value...

Reproduce code:
---------------
function &ret_ref(&$arr)
{
        return $arr;
}

$arr = array("111111", "2222222", "33333333");
$test = ret_ref($arr);
$test[] = "4444444444";
print_r($arr);


Expected result:
----------------
Array ( [0] => 111111 [1] => 2222222 [2] => 33333333 [3] => 4444444444
)

Actual result:
--------------
Array ( [0] => 111111 [1] => 2222222 [2] => 33333333 )


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39614&edit=1

Reply via email to