ID: 41214
Updated by: [EMAIL PROTECTED]
Reported By: php at warhog dot net
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux (Ubuntu 6.10/Linux 2.6.17)
PHP Version: 5.2.1
New Comment:
You're creating a reference to the variable that exists only in the
function scope.
Previous Comments:
------------------------------------------------------------------------
[2007-04-27 17:04:28] php at warhog dot net
Description:
------------
When having a reference-variable as parameter in a function and
referencing it on a local variable (inside the function) the
variable will keep the referenced value inside the function but not
outside. That's not the way I understand references in PHP.
Reproduce code:
---------------
<?php
function yet_another_function(&$foo)
{
$_foo = 3;
$foo =& $_foo;
var_dump($foo);
}
yet_another_function($bar);
var_dump($bar);
?>
Expected result:
----------------
int(3)
int(3)
Actual result:
--------------
int(3)
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41214&edit=1