Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56728 invoked by uid 1010); 3 Oct 2005 16:08:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56712 invoked from network); 3 Oct 2005 16:08:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2005 16:08:09 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:55349] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 72/65-54476-86751434 for ; Mon, 03 Oct 2005 12:08:09 -0400 Received: (qmail 17005 invoked from network); 3 Oct 2005 16:08:04 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 3 Oct 2005 16:08:04 -0000 Message-ID: <6.2.3.4.2.20051003085907.05286e20@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Mon, 03 Oct 2005 09:07:51 -0700 To: Rasmus Lerdorf Cc: "'PHP Developers Mailing List'" In-Reply-To: <43414A22.3040504@lerdorf.com> References: <002a01c5c823$97c04d20$e902a8c0@thinkpad> <6.2.3.4.2.20051003073141.0351a3d0@localhost> <43414A22.3040504@lerdorf.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] $ref =& $this; From: andi@zend.com (Andi Gutmans) Yep, I agree with this. We'll check but I'm pretty sure we're not corrupting EG(This) (which in any case is an implementation detail and too relevant to this discussion). As in PHP, you can't change the $this pointer, I do think we should have a message about this. I'd suggest an E_WARNING because it's for the same reason as over writing $this that you'd want to take a reference, you shouldn't really do it. We can also mention in the warning that this support will be deprecated in future versions... Andi At 08:11 AM 10/3/2005, Rasmus Lerdorf wrote: >Andi Gutmans wrote: > > Assigning to it will break "this" in the symbol table, or EG(This)? If > > it's the latter then it is a problem (and it's the reason I didn't > > support it to begin with). > >Given that: > > class foo { > function bar() { > $this->a = 1; > $ref = &$this; > $ref->b = 2; > $ref = null; > } > } > $x = new foo; > $x->bar(); > echo $x->a, $x->b; > >Outputs 12 and doesn't appear to cause any major badness internally, I >don't really see any reason to disallow it. If an E_STRICT could be >raised without affecting performance too much that would be good since >it is a useless assignment. Given the lack of badness on the php5 side >and the high level of goodness for php4 portability, I say leave it as >it is now. > >-Rasmus Zend/PHP Conference & Expo Power Your Business with PHP October 18-21, 2005 - San Francisco http://zend.kbconferences.com/