Re: [PHP-DEV] Passing functions to function by reference

2006-04-29 Thread Etienne Kneuss
Hello, I don't see the point using func_taking_reference($quiet=some_func()); The expression $quiet=some_func() will not "return" $quiet itself. So its not an alternative to $quiet=some_func(); func_taking_reference($quiet); You don't avoid the E_STRICT here. Regards Rasmus Lerdorf a écrit :

Re: [PHP-DEV] Passing functions to function by reference

2006-04-27 Thread Peter Brodersen
On Thu, 27 Apr 2006 17:24:55 -0400, in php.internals [EMAIL PROTECTED] (Rasmus Lerdorf) wrote: >It also tends to be a bug. Most functions that take an argument by >reference do so for a reason. There are of course exceptions to this as >you have pointed out and in those cases assuming your cod

Re: [PHP-DEV] Passing functions to function by reference

2006-04-27 Thread Rasmus Lerdorf
Brion Vibber wrote: Rasmus Lerdorf wrote: 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 intent

Re: [PHP-DEV] Passing functions to function by reference

2006-04-27 Thread Petar Nedyalkov
On Thursday 27 April 2006 23:01, Brion Vibber wrote: > Rasmus Lerdorf wrote: > >> 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

Re: [PHP-DEV] Passing functions to function by reference

2006-04-27 Thread Brion Vibber
Rasmus Lerdorf wrote: >> 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

Re: [PHP-DEV] Passing functions to function by reference

2006-04-26 Thread Brian Moon
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. Yeah, its more of a question of rewriting 6 years of PHP or not. We were half way done when we upgraded the dev machines to

Re: [PHP-DEV] Passing functions to function by reference

2006-04-26 Thread 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

Re: [PHP-DEV] Passing functions to function by reference

2006-04-26 Thread 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