#35548 [Opn->Bgs]: $class->${'varname'} does not work

From: Date: Sun, 04 Dec 2005 21:07:00 +0000
Subject: #35548 [Opn->Bgs]: $class->${'varname'} does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89727@lists.php.net to get a copy of this message
ID: 35548 Updated by: tony2001@php.net Reported By: capiCrimm at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: GNU Debian Sarge PHP Version: 5.1.1 New Comment: 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 >Where you can do ${'var'} with a normal variable That doesn't work either. Previous Comments: ------------------------------------------------------------------------ [2005-12-04 21:58:10] capiCrimm at gmail dot com Description: ------------ Where you can do ${'var'} with a normal variable trying to do the same thing with a class prop. results in a fatal error. It happens inside{$this} and outside the class. With public, private, and protected. It does work correctly with static variables. Reproduce code: --------------- <?php class Test { protected $variable = 'one'; public function test(){ print $this->variable; print $this->${'variable'}; } } $t = new Test; ?> Expected result: ---------------- oneone Actual result: -------------- one Fatal error: Cannot access empty property in /www/unstable/apache2/php5/admin/mRio/mRioDUM/bella1/test.php on line 9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35548&edit=1

« previous php.bugs (#89727) next »