Bug #64113 [Opn->Nab]: $this overriding
| From: | johannes@php.net | Date: | Thu, 31 Jan 2013 14:18:29 +0000 |
| Subject: | Bug #64113 [Opn->Nab]: $this overriding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176363@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64113&edit=1
ID: 64113
Updated by: johannes@php.net
Reported by: pavelpat at ya dot ru
Summary: $this overriding
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Linux 3.5.0 x64
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2013-01-31 12:25:10] pavelpat at ya dot ru
Description:
------------
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64113&edit=1