Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89648 invoked by uid 1010); 3 Oct 2005 14:29:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89627 invoked from network); 3 Oct 2005 14:29:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2005 14:29:39 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:51921] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E9/AC-54476-15041434 for ; Mon, 03 Oct 2005 10:29:38 -0400 Received: (qmail 20324 invoked from network); 3 Oct 2005 14:29:33 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 3 Oct 2005 14:29:33 -0000 Message-ID: <6.2.3.4.2.20051003072626.05e8f510@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Mon, 03 Oct 2005 07:29:30 -0700 To: Derick Rethans , PHP Developers Mailing List In-Reply-To: References: 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) Hey, I was the original person that started disallowing assigning $this by reference. Question really boils down to, how is this different from the reference fixes we did a couple of weeks ago, where due to too many apps breaking (and a lot broke) we created a work-around for this behavior with a warning. I think this case is pretty much identical, so we should probably treat it as such and escalate to error in 6.0. And At 06:09 AM 10/3/2005, Derick Rethans wrote: >Hello, > >Dmitry committed a fix earlier to ignore the & in the statement above. I >think this is not a good thing to do as it's simply conceptually wrong. >The first thing is that ignoring syntax without issuing a warning is >dubious because people might think it does actually work, and secondly >because I think that the code above is wrong anyway - somewhat in the >same way that "$this = new foo();" is wrong. > >There is never any need to assign $this by reference, nor to pass it by >reference to a function as it's an object anyway, making the references >pointless - I would even go as far as disallowing passing $this by >references to a function - where the reference has to be ignored again, >otherwise it allows you to chantge $this to a different object with: > >class Foo { > function byRef(&$f) { > $f = new Bar(); > } > > function modifyThis() { > $this->byRef($this); > } >} > >I think we should prevent people from writing syntax like this, as it is >not obvious what is going to happen. This means that we should revert >Dmitry's patch. > >regards, >Derick > >-- >Derick Rethans >http://derickrethans.nl | http://ez.no | http://xdebug.org > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php Zend/PHP Conference & Expo Power Your Business with PHP October 18-21, 2005 - San Francisco http://zend.kbconferences.com/