Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79433 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91462 invoked from network); 4 Dec 2014 23:18:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2014 23:18:57 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:47256] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/93-61462-0EBE0845 for ; Thu, 04 Dec 2014 18:18:56 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 98E982400A9; Thu, 4 Dec 2014 18:18:53 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NL5pjE_MqnJp; Thu, 4 Dec 2014 18:18:53 -0500 (EST) Received: from oa-res-27-210.wireless.abdn.ac.uk (oa-res-27-210.wireless.abdn.ac.uk [137.50.27.210]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 4032B2400D7; Thu, 4 Dec 2014 18:18:52 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Thu, 4 Dec 2014 23:18:50 +0000 Cc: Yasuo Ohgaki , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <58DB03A5-37B2-4244-BC4F-478DEAEC1153@ajf.me> References: To: Kalle Sommer Nielsen X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] Only variables can be passed by reference From: ajf@ajf.me (Andrea Faulds) > On 4 Dec 2014, at 19:58, Kalle Sommer Nielsen wrote: >=20 > I think we should solve these on a case-by-case basis, I can think of > one reason why the warning exists, and that is because it modifies the > array pointer and the argument is sent by reference. But I think we > can safely remove the warning if the parameter was not sent by > reference, as then we would expect the user to use the return value of > array_pop() to assign the value from. I don't think we should remove > warnings if you pass a statically value to it, sure some APIs can > return a variable length/dynamic array but then I think they should be > referenced into a variable and then passed to the function as they are > most likely going to be used later, I can't really think of a case > where it would be useful to send a return value of some API call to > array_multisort() and then use the boolean true or false to check if > it was a successful call for example.. Doing it case-by-case seems like the most pragmatic approach. That being said, I=E2=80=99m not sure there are many cases, if any, for = which I don=E2=80=99t think a warning should be shown. It feels like an = abuse of the internal array pointer functions = (next/prev/key/extract/etc.) to use them like this. It=E2=80=99d = probably be better to add non-by-ref functions that do the same thing = instead. -- Andrea Faulds http://ajf.me/