|  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
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
 [2007-10-31 16:10 UTC] felipensp at gmail dot com
Variable $this doens't recognize as variable variable.

Reproduce code:
$a = 'this';

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 ...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 16:32 UTC]
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]
Partially done, I'll add a note about $this not being modifiable as well.
 [2020-02-07 06:10 UTC]
Automatic comment on behalf of colder
Log: Fix #43163 ( cannot be referenced dynamically)
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 06:05:53 2022 UTC