#32523 [Opn->WFx]: wrong error message assigning to $this
ID: 32523
Updated by: tony2001@php.net
Reported By: info at rhalff dot com
-Status: Open
+Status: Wont fix
Bug Type: Feature/Change Request
Operating System: debian
PHP Version: 5CVS-2005-03-31 (dev)
New Comment:
$this is reserved.
Imagine that you're include'ing this code in a class where $this
exists. We have to prevent $this overwriting in this case.
Previous Comments:
------------------------------------------------------------------------
[2005-04-01 00:09:56] info at rhalff dot com
Description:
------------
The error message when assigning to $this is kinda misleading. It seems
to default to cannot re-assign $this even when not in object context.
Maybe it could be defaulted to some kind of error message stating $this
is a reserved variable name which can only be used in object context.
Reproduce code:
---------------
<?php $this = ''; ?>
Expected result:
----------------
something else then cannot re-assign $this...
Actual result:
--------------
PHP Fatal error: Cannot re-assign $this in.....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32523&edit=1
Thread (2 messages)