Re: Only variables or references can be returned by reference

From: Date: Mon, 12 Jan 2004 07:05:12 +0000
Subject: Re: Only variables or references can be returned by reference
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-6986@lists.php.net to get a copy of this message
At 10:09 PM 1/11/2004 -0500, Daniel Convissor wrote:
On Sun, Jan 11, 2004 at 07:36:53PM +0100, Lukas Smith wrote: So does this mean we can all remove our php5 compatibility hacks that relate to the above bug report? I don't think that's wise. Even though PHP 5 now won't complain about it, PHP 4 had problems with returning by reference on non variables even though it didn't produce any warnings. Let alone, only returning a variable when returning by reference is the right thing to do. Just because you can get away with not doing it doesn't make it right.
There were two issues here (IIRC): a) People returning non-variables by references. In this case, I agree with you I'm pretty sure we added an E_STRICT. b) A function which returned a variable by reference couldn't be returned by reference. I think this one is probably OK to code. Andi

« previous php.internals (#6986) next »