Bug #16207: var referencing doesnt work on global vars?
| From: | vedad at kajtaz dot net | Date: | Thu, 21 Mar 2002 17:57:51 +0000 |
| Subject: | Bug #16207: var referencing doesnt work on global vars? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-3073@lists.php.net to get a copy of this message | ||
From: vedad@kajtaz.net
Operating system: linux 2.2.20
PHP version: 4.1.2
PHP Bug Type: Scripting Engine problem
Bug description: var referencing doesnt work on global vars?
Hello,
Using references from and to global vars inside a function doesnt seem to
work.
Try this out:
---->8----->8----->8----->8-
<?
function SomeFunction()
{
global $a, $b, $c;
$d = array(1, 2, 3);
$a = $d;
$b = &$a;
$c = &$a;
}
SomeFunction();
?><pre>a:<br><?print_r($a)?></pre><hr><?
?><pre>b:<br><?print_r($b)?></pre><hr><?
?><pre>c:<br><?print_r($c)?></pre><hr><?
// end
?>
---->8----->8----->8----->8-
Logically, $b and $c should be references to $a, but they seem to be empty
vars!
Thanks,
-- vedad
--
Edit bug report at http://bugs.php.net/?id=16207&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16207&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16207&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16207&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16207&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16207&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16207&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16207&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16207&r=submittedtwice