Edit report at https://bugs.php.net/bug.php?id=30288&edit=1
ID: 30288 Updated by: ni...@php.net Reported by: Jones at miliz dot org Summary: Problems making a variable a reference which was passed by reference -Status: Open +Status: Wont fix Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: Linux PHP Version: 4.3.9 Block user comment: N Private report: N New Comment: Assigning by-reference to a variable that already is a reference will break the existing reference. What you want is write "$second = $source" instead of "$second =& $source". This will fix your issue. Previous Comments: ------------------------------------------------------------------------ [2004-09-30 11:04:51] Jones at miliz dot org Description: ------------ Making a variable, which was passed by reference, a reference to another variable inside the function won't work outside this function Reproduce code: --------------- <?php function &testReference(&$first, &$second) { $source = 'my Test'; $first = $source; $second =& $source; var_dump($second); return $second; } $ref3 =& testReference($ref1, $ref2); var_dump($ref1); var_dump($ref2); var_dump($ref3); ?> Expected result: ---------------- string(7) "my Test" string(7) "my Test" string(7) "my Test" string(7) "my Test" Actual result: -------------- string(7) "my Test" string(7) "my Test" NULL string(7) "my Test" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=30288&edit=1