From: djneoform at gmail dot com
Operating system: Windows 2003 Standard
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: Assigning a reference to a reference variable in a function
returns null
Description:
------------
If you pass a variable by reference in a function, then within the
function assign that variable a reference to another variable, the
variable's reference gets overwritten and the variable (when the function
ends) contains null.
Reproduce code:
---------------
$GLOBALS['glob_var'] = 10;
$var = funk($ref_var);
echo 'SHOULD BE 10: '.$var;
function funk(&$ref_var)
{
$ref_var = &$GLOBALS['glob_var'];
}
Expected result:
----------------
> SHOULD BE 10: 10
Actual result:
--------------
> SHOULD BE 10:
--
Edit bug report at http://bugs.php.net/?id=44705&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44705&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44705&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44705&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44705&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44705&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44705&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44705&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44705&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44705&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44705&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44705&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44705&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44705&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44705&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44705&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44705&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44705&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44705&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44705&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44705&r=mysqlcfg