ID: 35548 User updated by: capiCrimm at gmail dot com 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:
eh. I figured it out, instead of $this->${'var'} you use $this->{'var'} Previous Comments: ------------------------------------------------------------------------ [2005-12-04 23:35:37] capiCrimm at gmail dot com I'll agree that this may not be a bug, rather how you choose to develop the engine. However ${} does work with normal variables and class static variables. The following prints ``five'' as expected. <?php $one = 'five'; print ${'one'}; ?> ------------------------------------------------------------------------ [2005-12-04 22:06:59] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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