Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22984 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81559 invoked by uid 1010); 26 Apr 2006 22:41:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 81544 invoked from network); 26 Apr 2006 22:41:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2006 22:41:49 -0000 X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.5 (sometimes 2.4) (4) Received: from ([204.11.219.139:36774] helo=lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id DF/66-19715-C27FF444 for ; Wed, 26 Apr 2006 18:41:48 -0400 Received: from [65.74.192.250] (dhcp65-74-192-250.oam.orl.wayport.net [65.74.192.250]) (authenticated bits=0) by lerdorf.com (8.13.6/8.13.6/Debian-1) with ESMTP id k3QMfSEm008244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 26 Apr 2006 15:41:40 -0700 Message-ID: <444FF716.6070201@lerdorf.com> Date: Wed, 26 Apr 2006 18:41:26 -0400 User-Agent: Thunderbird 3.0a1 (Macintosh/20060413) MIME-Version: 1.0 To: Brian Moon CC: internals@lists.php.net References: <444FF5CD.2010805@dealnews.com> In-Reply-To: <444FF5CD.2010805@dealnews.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Passing functions to function by reference From: rasmus@lerdorf.com (Rasmus Lerdorf) Brian Moon wrote: > In PHP4, you could do: > > function test() > { > return array(1,2,3); > } > > $var = array_shift(test()); > > PHP 5.0 broke this. There was a fatal error on the array_shift that > only variables could be passed by reference. There was a good argument > for it. So, we started migrating our code. > > Well, seems this works in 5.1. So, my question is, was it an > intentional "fix" or will this break again and we need to continue to > watch for this? In 5.1 this now throws an E_STRICT instead of a warning. It is still a bad idea to pass a tempvar by reference, so yes, you should strive to write E_STRICT clean code. -Rasmus