Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77993 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68070 invoked from network); 14 Oct 2014 13:42:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2014 13:42:12 -0000 Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.52 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 209.85.218.52 mail-oi0-f52.google.com Received: from [209.85.218.52] ([209.85.218.52:46203] helo=mail-oi0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/D8-26074-3382D345 for ; Tue, 14 Oct 2014 09:42:12 -0400 Received: by mail-oi0-f52.google.com with SMTP id a3so16480966oib.39 for ; Tue, 14 Oct 2014 06:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QUScJ47i4grPBb1s/e5+wKkI2CgmTYMLGmN7Ay/QNSw=; b=UToGwmld1J2wV0bXf6zQzdJGqEh9ppoq+tTsh16sq5jK3PXDLisTgkfbG2amk3Y0H7 pAtzNmKe3Li2rroDOaiNps8lFpiP/RwsJ8yHFSlBOd2dNqQ54g5MgDz14YsCIBuZzqTU gttkVCqtmYt2yi9x+tdDnDKlhFZ01LGVOrQ1+RQNDgeJ2RErS37TIhizDIY10Y4NNbQP Mg8h2ImNllfsLJoxQ4PSJaUoXdaXSFQDEtP2TzUz0Ux3jwFCk6GqXCb1mWIbniBuIvoS I7b6/sNEw9hE1yKqOaRcgOXcUnxjCKokyS1mp18FCzuX8GbXlvdxVGnrCFxT8/fq4HhR vugw== MIME-Version: 1.0 X-Received: by 10.182.73.196 with SMTP id n4mr613624obv.51.1413294129268; Tue, 14 Oct 2014 06:42:09 -0700 (PDT) Received: by 10.202.169.201 with HTTP; Tue, 14 Oct 2014 06:42:09 -0700 (PDT) In-Reply-To: References: <776669CE-9E8C-4069-9834-C7275CCA0EF4@ajf.me> Date: Tue, 14 Oct 2014 06:42:09 -0700 Message-ID: To: Andrea Faulds Cc: Andrey Andreev , PHP internals list Content-Type: multipart/alternative; boundary=089e01160db089cec10505622e3b Subject: Re: [PHP-DEV] New globals for PUT and DELETE From: kris.craig@gmail.com (Kris Craig) --089e01160db089cec10505622e3b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Oct 14, 2014 at 6:25 AM, Andrea Faulds wrote: > > On 14 Oct 2014, at 14:23, Andrey Andreev wrote: > > > That being said, from a purely semantic prospective, both $_GET and > > $_POST should be tossed - yes. In reality, you can't do that because > > virtually all PHP applications use them. But this is no reason to add > > even more global vars with such misleading ... meanings. > > Let=E2=80=99s add $_REQUEST_BODY and $_QUERY_STRING and make them aliases= of $_GET > and $_POST then. Because they=E2=80=99re aliases (by-reference supergloba= ls), > there=E2=80=99s no additional memory consumption, but we finally have san= er names. > -- > Andrea Faulds > http://ajf.me/ > > I don't think that would be a good idea, either. They require more typing and it'd probably be a lot easier for devs to remember which one means GET and which one means POST. The fact that $_PUT and $_DELETE aren't necessary because we can use other approaches to get that data is irrelevant. Having globals for two REST methods but not the other two is very counter-intuitive from a dev standpoint. We just recently discussed how PHP tends to have duplicate ways of doing something in order to make it as easy as possible. I believe this is one of those times. It would make it a lot easier for devs, particularly the ones less experienced with REST, to create APIs that actually use the correct methods without running into the confusion over why there's a $_GET and a $_POST but not a $_PUT or a $_DELETE. PHP is supposed to be KISS, right? Well, the current reliance on php://input for two methods but not the other two invites confusion. That makes it less-than simple, I believe. Removing or renaming $_GET and $_POST would also create confusion and almost certainly cause widespread BC breakage on a pretty massive scale. And there's really no gain to offset that. So that just leaves us with either continuing to have two REST methods but not the others or add a $_PUT and a $_DELETE, even if they just alias to php://input again. --Kris --089e01160db089cec10505622e3b--