Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18855 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42492 invoked by uid 1010); 14 Sep 2005 00:51:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42477 invoked from network); 14 Sep 2005 00:51:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Sep 2005 00:51:49 -0000 X-Host-Fingerprint: 220.245.213.234 220-245-213-234-act.tpgi.com.au Received: from ([220.245.213.234:14830] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 12/8E-41173-52477234 for ; Tue, 13 Sep 2005 20:51:49 -0400 Message-ID: <12.8E.41173.52477234@pb1.pair.com> To: internals@lists.php.net Date: Wed, 14 Sep 2005 10:51:31 +1000 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <43276E03.2040502@lerdorf.com> In-Reply-To: <43276E03.2040502@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 220.245.213.234 Subject: Re: [PHP-DEV] Reference handling change and PHP 4.4.0 From: colin@encode.net.au (Colin Tucker) Hi Rasmus, thanks for replying, I appreciate your feedback. Rasmus Lerdorf wrote: > We have been looking to see if there is a way to fix the memory > corruption issue in a way that has less of an impact on existing code. > This doesn't change the fact that every error you get is actually an > error in the code you are running. Yes, I know this now, but I guess at the time it seemed ok, because it wasn't an error then. :) > Right now the change in 4.4 and 5.x is to complain loudly when you pass > a reference to something without any associated storage. In both of the > above examples there is no permanent storage associated with either of > the passed arguments, so trying to get a reference to this storage makes > very little sense. The only feasible way we might be able to work > around this is to make a copy of such bogus reference attempts and > effectively just pretend they were passed by value. I think it is a bit > of a hack, but at the same time the breakage of existing apps has been > more widespread than I think anybody anticipated. I'd still want to > throw a notice to let people know they are doing something odd though. Well for one I'm glad that PHP5 handles all objects as references now because this was primarily the reason I used references in PHP4, i.e. to ensure that copies of objects were not being passed around. Plus, I'm now in the process of converting my core code to PHP5 using it's 'proper OO' features. However, as you mentioned, this still leaves a lot of broken PHP4 code under 4.4 and above. I completely understand now why the change was made, I just guess a lot of us were doing funny things with references that we shouldn't have been. I suppose it's a tricky situation for you guys as there was no solution that wouldn't cause at least some breakage. Cheers, Colin.