PHP 4.0 Bug #5532: Aliasing to array element affecting value downstream
| From: | tom dot ferguson at uphs dot upenn dot edu | Date: | Wed, 12 Jul 2000 17:52:11 +0000 |
| Subject: | PHP 4.0 Bug #5532: Aliasing to array element affecting value downstream | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-24210@lists.php.net to get a copy of this message | ||
From: tom.ferguson@uphs.upenn.edu
Operating system: WinNT 4.0
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Misbehaving function
Bug description: Aliasing to array element affecting value downstream
unset($a);
unset($v);
unset($k);
$a =
array('x'=>"p",'y'=>"q",'z'=>"r");
foreach($a as $k => $v){
echo $k . " => " .$v . "<br>";
}
echo "<br>";
$v = $a['y'];
echo $v . "<br>";
echo $a['y'] . "<br>";
echo "<br>";
$v = &$a['y'];
echo $v . "<br>";
echo $a['y'] . "<br>";
echo "<br>";
reset($a);
echo $v . "<br>";
echo $a['y'] . "<br>";
echo "<br>";
foreach($a as $k => $v){
echo $k . " => " .$v . "<br>";
}