Edit report at https://bugs.php.net/bug.php?id=64113&edit=1

 ID:                 64113
 Updated by:         johan...@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

Reply via email to