Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19337 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38999 invoked by uid 1010); 3 Oct 2005 13:21:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38984 invoked from network); 3 Oct 2005 13:21:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2005 13:21:41 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:56261] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 1A/E5-54476-46031434 for ; Mon, 03 Oct 2005 09:21:41 -0400 Received: from [192.168.1.3] (dslb-082-083-230-032.pools.arcor-ip.net [82.83.230.32]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id A113135C37F; Mon, 3 Oct 2005 15:22:21 +0200 (CEST) Date: Mon, 3 Oct 2005 15:21:38 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <122233927.20051003152138@marcus-boerger.de> To: Derick Rethans Cc: PHP Developers Mailing List In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] $ref =& $this; From: helly@php.net (Marcus Boerger) Hello Derick, Monday, October 3, 2005, 3:09:22 PM, you 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. Same here. Best regards, Marcus