|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64113 $this overriding
Submitted: 2013-01-31 12:25 UTC Modified: 2013-01-31 14:18 UTC
From: pavelpat at ya dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.11 OS: Linux 3.5.0 x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pavelpat at ya dot ru
New email:
PHP Version: OS:


 [2013-01-31 12:25 UTC] pavelpat at ya dot ru
In any context impossible to override $this, so this code is incorrect:

$this = 123;

But possible to rewrite $this with this example:

$t = 'this';
$$t = 123;
var_dump($this); // int(123)

Test script:
$t = 'this';
$$t = 123;
var_dump($this); // int(123)

Expected result:
Runtime error

Actual result:
No runtime error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-31 14:18 UTC]
-Status: Open +Status: Not a bug
 [2013-01-31 14:18 UTC]
We try to prevent mistakes. We don't prevent you from shooting in your foot. Adding the check to all potential cases would cause notable slowdowns.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 09:01:24 2023 UTC