php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26798 Reference is assigned locally
Submitted: 2004-01-05 14:27 UTC Modified: 2004-01-06 17:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ilia at manual dot ru Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.4 OS: Windows XP,Linux
Private report: No CVE-ID: None
 [2004-01-05 14:27 UTC] ilia at manual dot ru
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-06 17:47 UTC] sniper@php.net
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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 13:01:28 2024 UTC