Re: [RFC] Fix inconsistent behavior of $this variable
| From: | Yasuo Ohgaki | Date: | Tue, 24 May 2016 07:54:37 +0000 |
| Subject: | Re: [RFC] Fix inconsistent behavior of $this variable | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93475@lists.php.net to get a copy of this message | ||
Jesse,
On Tue, May 24, 2016 at 4:25 PM, Jesse Schalken <me@jesseschalken.com> wrote:
> On Tue, May 24, 2016 at 5:18 PM, Dmitry Stogov <dmitry@zend.com> wrote:
>
>> In fact $this is not a regular local variable and it must not be
>> re-assigned.
>>
>>
> You're just restating the premise for my question. Why is it not a regular
> local variable? Why must it not be reassigned?
$this must be a object you're accessing.
If you can change $this, you'll suddenly loose object.
PHP 4 treated $this as regular variable and caused lots of problems.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net