From:             ilia at manual dot ru
Operating system: Windows XP,Linux
PHP version:      4.3.4
PHP Bug Type:     Variables related
Bug description:  Reference is assigned locally

Description:
------------
The script should output '1', but it outputs '0'.
Looks like the assignment is made locally.

But if I replace '$a =& $b' with '$GLOBALS['a'] =& $b'
the script will output '1' (right behaviour)


Reproduce code:
---------------
$b=1;
$a=0;

function f()
{
    global $a,$b;
    
    $a =& $b;
}

f();
echo $a;

Expected result:
----------------
1

Actual result:
--------------
0

-- 
Edit bug report at http://bugs.php.net/?id=26798&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26798&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26798&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26798&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26798&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26798&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26798&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26798&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26798&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26798&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26798&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26798&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26798&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26798&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26798&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26798&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26798&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26798&r=float

Reply via email to