From: [EMAIL PROTECTED]
Operating system: linux
PHP version: 4.1.2
PHP Bug Type: Variables related
Bug description: variable variables need { } to work with classes
When using a variable variable in a class, $$this->varname does not work,
${$this->varname} must be used.
Here is a simple script to show this in action. Put the {} in and it will
work:
<?
$id = "yes";
class testClass {
var $varname;
function testClass($varname) {
$this->varname = $varname;
}
function foo() {
global $$this->varname;
echo "$".$this->varname." is ".$$this->varname;
}
}
$test = new testClass("id");
$test->foo();
?>
--
Edit bug report at http://bugs.php.net/?id=15871&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=15871&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15871&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15871&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15871&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15871&r=support
Expected behavior: http://bugs.php.net/fix.php?id=15871&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15871&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=15871&r=submittedtwice