php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31068 Can't call variable objects.
Submitted: 2004-12-13 15:16 UTC Modified: 2004-12-13 15:47 UTC
From: jody_leigh_salt at yahoo dot co dot uk Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.2 OS: XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jody_leigh_salt at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2004-12-13 15:16 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-13 15:35 UTC] jody_leigh_salt at yahoo dot co dot uk
Edited submission as I feel it could be better catagorised
 [2004-12-13 15:47 UTC] derick@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 09:01:32 2025 UTC