Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18946 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60955 invoked by uid 1010); 15 Sep 2005 03:51:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60940 invoked from network); 15 Sep 2005 03:51:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2005 03:51:44 -0000 X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.4/2.6 Received: from ([204.11.219.139:59409] helo=colo.lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id D8/FB-41173-FCFE8234 for ; Wed, 14 Sep 2005 23:51:44 -0400 Received: from [192.168.2.104] (CPE00131063dcac-CM0011aec551ea.cpe.net.cable.rogers.com [65.49.170.67]) (authenticated bits=0) by colo.lerdorf.com (8.13.4/8.13.4/Debian-4) with ESMTP id j8F3pUsx002816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 14 Sep 2005 20:51:31 -0700 Message-ID: <4328EFC1.3030500@lerdorf.com> Date: Wed, 14 Sep 2005 23:51:29 -0400 User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Leigh Makewell CC: internals@lists.php.net References: <43276022.6020702@encode.net.au> <7C.1C.41173.4D828234@pb1.pair.com> <63.BA.41173.BB6E8234@pb1.pair.com> In-Reply-To: <63.BA.41173.BB6E8234@pb1.pair.com> X-Enigmail-Version: 0.92.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Reference handling change and PHP 4.4.0 From: rasmus@lerdorf.com (Rasmus Lerdorf) Leigh Makewell wrote: > a perfectly legal statement like this $x = current(explode(' ','a b')); In this particular case, current() did not need to take a reference since it doesn't modify anything. This has been fixed in CVS. That's still not how I'd write that though. I would write: list($x) = explode(' ','a b'); Another way to write this: $x = array_shift(explode(' ','a b')); This is where it gets tricky. Is this legal code? We are modifying the argument and immediately discarding the modification. The user might want to know about that, so to me it makes sense that this throws a NOTICE. I do agree with folks who don't like this being a fatal error. I don't think it should be either and this is what we have been discussing. That doesn't change the fact that a lot of these examples are not optimal coding examples. There are usually more direct ways that doesn't involve a useless operation that ends up getting discarded right away. So while the tone of some of these messages may not be great, often the suggestion that the code in question isn't very good is accurate. -Rasmus