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 this is not your bug, you can add a comment by following this link.
If this is your bug, but 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC