#38317 [WFx]: "cannot reassign $this" outside object scope
| From: | giunta dot gaetano at sea-aeroportimilano dot it | Date: | Fri, 04 Aug 2006 07:48:57 +0000 |
| Subject: | #38317 [WFx]: "cannot reassign $this" outside object scope | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100319@lists.php.net to get a copy of this message | ||
ID: 38317
User updated by: giunta dot gaetano at sea-aeroportimilano dot it
Reported By: giunta dot gaetano at sea-aeroportimilano dot it
Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: windows 2000
PHP Version: 5.1.4
New Comment:
That's just what I was afraid of (hence my asking for it).
I hoped that the engine would be smarter than that, and figure out the
error 'just in time', ie. checking out the scope when finding the
assignment and only flagging it as error when inside a class method...
BTW: maybe it should be marked mopre clearly in the manual?
Previous Comments:
------------------------------------------------------------------------
[2006-08-03 17:27:47] tony2001@php.net
This is a real necessity, since you can do <?php class test { function
foo () { include "test.php"; }} ?> and reassign $this in test.php.
------------------------------------------------------------------------
[2006-08-03 17:03:15] giunta dot gaetano at sea-aeroportimilano dot it
Description:
------------
It seems like php 5.1.4 does not like an assignment to variable
'$this', regardless of the scope:
- objet method
- function
- global
Is this a real necessity or just a plain old bug???
Reproduce code:
---------------
<?php
function that($it){
$this = '';
}
?>
or
<?php
$this = '';
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38317&edit=1