From: Jones at miliz dot org
Operating system: Linux
PHP version: 4.3.9
PHP Bug Type: Variables related
Bug description: Problems making a variable a reference which was passed by reference
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 bug report at http://bugs.php.net/?id=30288&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30288&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30288&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30288&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30288&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30288&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30288&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30288&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30288&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30288&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30288&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30288&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30288&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30288&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30288&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30288&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30288&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30288&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30288&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30288&r=mysqlcfg