ID:               44705
 Updated by:       [EMAIL PROTECTED]
 Reported By:      djneoform at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows 2003 Standard
 PHP Version:      5.2.5
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You don't even return anything from the funk() function... so of course
$ref == NULL.


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

[2008-04-11 21:02:45] djneoform at gmail dot com

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 this bug report at http://bugs.php.net/?id=44705&edit=1

Reply via email to