PHP 4.0 Bug #5490: class variables get mixed up
| From: | dietmar dot kling at sam-net dot de | Date: | Mon, 10 Jul 2000 10:05:50 +0000 |
| Subject: | PHP 4.0 Bug #5490: class variables get mixed up | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23898@lists.php.net to get a copy of this message | ||
From: dietmar.kling@sam-net.de
Operating system: linux 2.2.16
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: class variables get mixed up
<?php
class bugtest
{
var $A = -1;
var $B = -1;
function setVarA($value)
{
$this->$A=$value;
}
function setVarB($value)
{
$this->$B=$value;
}
function getVarA()
{
return $this->$A;
}
function getVarB()
{
return $this->$B;
}
}
echo "<BR>";
echo "Current PHP version: ".phpversion();
$bug = new bugtest;
$bug->setVarA(13);
$bug->setVarB(7);
echo "<BR>";
echo $bug->getVarA();
echo "<BR>";
echo $bug->getVarB();
?>
This is the output !! ( Where has "13" gone???")
Current PHP version: 4.0.1pl2
7
7