#31068 [Opn->Bgs]: Can't call variable objects.

From: Date: Mon, 13 Dec 2004 14:47:46 +0000
Subject: #31068 [Opn->Bgs]: Can't call variable objects.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-70153@lists.php.net to get a copy of this message
ID: 31068 Updated by: derick@php.net Reported By: jody_leigh_salt at yahoo dot co dot uk -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: XP PHP Version: 5.0.2 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. $this can not be used as variable variable, as it's not a variable but a language construct. Previous Comments: ------------------------------------------------------------------------ [2004-12-13 15:35:09] jody_leigh_salt at yahoo dot co dot uk Edited submission as I feel it could be better catagorised ------------------------------------------------------------------------ [2004-12-13 15:16:11] jody_leigh_salt at yahoo dot co dot uk Description: ------------ Can't call variable objects. Where as in PHP 4 you can!! Reproduce code: --------------- class bug_test { function bug_test() { //create a test var $this->test_var = 'hello world'; } function echo_test_var() { echo $this->test_var; } function say_hello() { $object = 'this'; $$object->echo_test_var(); } } //let show this bug!! $test = new bug_test(); $test->say_hello(); Expected result: ---------------- Should print "hello world to screen" Actual result: -------------- Notice: Undefined variable: this in c:\www\php_newrust\bug.php on line 20 Fatal error: Call to a member function echo_test_var() on a non-object in c:\www\php_newrust\bug.php on line 20 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31068&edit=1

« previous php.bugs (#70153) next »