Re: Passing functions to function by reference

From: Date: Thu, 27 Apr 2006 01:00:40 +0000
Subject: Re: Passing functions to function by reference
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-22985@lists.php.net to get a copy of this message
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

« previous php.internals (#22985) next »