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 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.
>
> Stupid question: why is it a bad idea?

Check the mailing-list archive - there was a long discussion on this topic 
some 4, 5 months ago.

>
> I would expect these to be equivalent for all intents and purposes:
>
>   func_taking_reference(some_func());
>
> and
>
>   $temp = some_func();
>   func_taking_reference($temp);
>
> where $temp is never used again and quickly passes out of scope.
>
> Is there some reason that they are not considered equivalent, or that they
> cannot or should not be made equivalent?

Yes, of course :-) Nothing happens by chance here.

>
> I seem to remember a reason being quoted for all these reference-related
> changes something like it can cause memory corruption. But that would
> appear to be an implementation bug, not an essential difficulty, as if it
> were really *memory corruption* I can't imagine it being turned back on in
> 5.1. :)
>
> -- brion vibber (brion @ pobox.com / brion @ wikimedia.org)

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpzEIbNZpTlM.pgp
Description: PGP signature

Reply via email to