php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43163 $this with variable variable
Submitted: 2007-10-31 16:10 UTC Modified: 2007-11-16 15:58 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: felipensp at gmail dot com Assigned: colder (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3CVS-2007-10-31 (snap) OS: Linux
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: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-31 16:10 UTC] felipensp at gmail dot com
Description:
------------
Variable $this doens't recognize as variable variable.

Reproduce code:
---------------
$a = 'this';
$$a->b;

Expected result:
----------------
Fatal error: Using $this when not in object context

Actual result:
--------------
Notice: Undefined variable: this ...

Notice: Trying to get property of non-object ...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 16:32 UTC] johannes@php.net
As of PHP 5 $this is a very special variable, I couldn't find anything in the docs about it's limitations, so I mark it as a doc bug.

Related to the original report: I'm also not seeing a hint that you can't assign any value to $this in the docs (not even outside a class)
 [2007-11-13 13:13 UTC] colder@php.net
Partially done, I'll add a note about $this not being modifiable as well.
 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of colder
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=dbd16c35ed9e6a8b3f1b5108504d1a0b50e11979
Log: Fix #43163 ( cannot be referenced dynamically)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Mar 15 01:01:29 2025 UTC