#26307 [NEW]: Variable reference assignments in functions
| From: | soywiz at hotmail dot com | Date: | Tue, 18 Nov 2003 20:58:01 +0000 |
| Subject: | #26307 [NEW]: Variable reference assignments in functions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-50661@lists.php.net to get a copy of this message | ||
From: soywiz at hotmail dot com
Operating system: Windows
PHP version: 4.3.4
PHP Bug Type: Variables related
Bug description: Variable reference assignments in functions
Description:
------------
Within a function a reference to another variable cannot be assigned to
its to a global variable.
I also proved this example in php 4.3.3
Sorry by my bad english
In spanish: Dentro de una función no se le puede asignar a una variable
global una referencia a otra variable (también global).
He probado este ejemplo en php 4.3.3 y php 4.3.4
Reproduce code:
---------------
<?php
$a = 'a';
$b = 'b';
function f() {
global $a, $b;
$b = &$a; // Fails
}
f();
echo $b;
$b = &$a; // Works
echo $b;
?>
Expected result:
----------------
aa
Actual result:
--------------
ba
--
Edit bug report at http://bugs.php.net/?id=26307&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26307&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26307&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26307&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26307&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26307&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26307&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26307&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26307&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26307&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26307&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26307&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26307&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26307&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26307&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26307&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26307&r=float