#41214 [NEW]: referencing a reference parameter on a function-local variable does not work
| From: | php at warhog dot net | Date: | Fri, 27 Apr 2007 17:04:28 +0000 |
| Subject: | #41214 [NEW]: referencing a reference parameter on a function-local variable does not work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-112007@lists.php.net to get a copy of this message | ||
From: php at warhog dot net
Operating system: Linux (Ubuntu 6.10/Linux 2.6.17)
PHP version: 5.2.1
PHP Bug Type: Variables related
Bug description: referencing a reference parameter on a function-local variable does not work
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 bug report at http://bugs.php.net/?id=41214&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41214&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41214&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41214&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41214&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41214&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41214&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41214&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41214&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41214&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41214&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41214&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41214&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41214&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41214&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41214&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41214&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41214&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41214&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41214&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41214&r=mysqlcfg