Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22985 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42614 invoked by uid 1010); 27 Apr 2006 01:01:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42585 invoked from network); 27 Apr 2006 01:01:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2006 01:01:08 -0000 X-PHP-List-Original-Sender: jason@ionzoft.com X-Host-Fingerprint: 66.216.66.81 mail.ionzoft.com Linux 2.4/2.6 Received: from ([66.216.66.81:52524] helo=mail.ionzoft.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id FB/8D-19715-3D710544 for ; Wed, 26 Apr 2006 21:01:07 -0400 Received: from JASONGARBER2 (207-255-4-232-static.aoo.pa.atlanticbb.net [207.255.4.232]) by mail.ionzoft.com (Postfix) with ESMTP id D90398A407C; Wed, 26 Apr 2006 21:01:59 -0400 (EDT) Date: Wed, 26 Apr 2006 21:00:40 -0400 X-Mailer: The Bat! (v3.65.03) Professional Reply-To: Jason Garber Organization: IonZoft, Inc. X-Priority: 3 (Normal) Message-ID: <1724175614.20060426210040@ionzoft.com> To: Rasmus Lerdorf CC: Brian Moon , internals@lists.php.net In-Reply-To: <444FF716.6070201@lerdorf.com> References: <444FF5CD.2010805@dealnews.com> <444FF716.6070201@lerdorf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Passing functions to function by reference From: jason@ionzoft.com (Jason Garber) Hello Rasmus, RL> In 5.1 this now throws an E_STRICT instead of a warning. It is still a RL> bad idea to pass a tempvar by reference, so yes, you should strive to RL> write E_STRICT clean code. At the possible expense of being blamed and flamed, I'll say it... ifsetor($var, 'default') would go a long way to accommodate E_STRICT code. -- Best regards, Jason mailto:jason@ionzoft.com Wednesday, April 26, 2006, 6:41:26 PM, you wrote: RL> 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? RL> In 5.1 this now throws an E_STRICT instead of a warning. It is still a RL> bad idea to pass a tempvar by reference, so yes, you should strive to RL> write E_STRICT clean code. RL> -Rasmus