Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22997 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35505 invoked by uid 1010); 27 Apr 2006 20:01:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35490 invoked from network); 27 Apr 2006 20:01:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2006 20:01:16 -0000 X-PHP-List-Original-Sender: brion@pobox.com X-Host-Fingerprint: 207.106.133.28 proof.pobox.com Linux 2.5 (sometimes 2.4) (4) Received: from ([207.106.133.28:44084] helo=proof.pobox.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 65/AF-11022-B0321544 for ; Thu, 27 Apr 2006 16:01:15 -0400 Received: from proof (localhost [127.0.0.1]) by proof.pobox.com (Postfix) with ESMTP id 485B5105FA8; Thu, 27 Apr 2006 16:01:12 -0400 (EDT) Received: from [10.10.2.184] (unknown [70.103.133.226]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by proof.sasl.smtp.pobox.com (Postfix) with ESMTP id AA9CE42E7C; Thu, 27 Apr 2006 16:01:09 -0400 (EDT) Message-ID: <44512305.90207@pobox.com> Date: Thu, 27 Apr 2006 13:01:09 -0700 User-Agent: Thunderbird 1.5.0.2 (Macintosh/20060308) MIME-Version: 1.0 To: Rasmus Lerdorf Cc: Brian Moon , internals@lists.php.net References: <444FF5CD.2010805@dealnews.com> <444FF716.6070201@lerdorf.com> In-Reply-To: <444FF716.6070201@lerdorf.com> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigAE982D1CFF6A568832F875AE" Subject: Re: [PHP-DEV] Passing functions to function by reference From: brion@pobox.com (Brion Vibber) --------------enigAE982D1CFF6A568832F875AE Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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? >=20 > 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? I would expect these to be equivalent for all intents and purposes: func_taking_reference(some_func()); and $temp =3D 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 the= y cannot or should not be made equivalent? 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 b= e an implementation bug, not an essential difficulty, as if it were really *me= mory corruption* I can't imagine it being turned back on in 5.1. :) -- brion vibber (brion @ pobox.com / brion @ wikimedia.org) --------------enigAE982D1CFF6A568832F875AE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEUSMFwRnhpk1wk44RAnZkAJ4le9MIS9+ts2iW2f7cX+rjtam8LACeJT1f XPC0riJ56y3eUol1pOP7BQU= =bUjf -----END PGP SIGNATURE----- --------------enigAE982D1CFF6A568832F875AE--