Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76616 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59137 invoked from network); 17 Aug 2014 20:55:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Aug 2014 20:55:58 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.53 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.53 mail-qa0-f53.google.com Received: from [209.85.216.53] ([209.85.216.53:43876] helo=mail-qa0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/44-28428-DD611F35 for ; Sun, 17 Aug 2014 16:55:57 -0400 Received: by mail-qa0-f53.google.com with SMTP id v10so3702338qac.26 for ; Sun, 17 Aug 2014 13:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=PDQrQc5LqRafX+3wDXAcq2x3jApZuqI8KntJQoADtfY=; b=ilNrQpgDR0oI/lMu/33Sy8nKz/AVvArX3fpXsYe71pS/H/uja5rZfPZGhESXlOutVC hY3P7LDQz1p/lpaDqp7GKIxQtK/uPCTbYMWUlkGpkAtqcWGkgsoMuWE8JGYRmJ++yKJU 0Uf9TDpHFpD1PjYNwiFRpL0NPCTUNnDRXxDcD1YnoBazyZmg1bnMvZJxUaU2E2Ba92dy p7Qwf+2Vfh4dI9JOkxOXa+cDx+yOQTkH7pb5Cx4T07Q+sh4ASDCKZUdygfdaiQMc71wq VbVfD5xEllLml+wAcTSH4stl2VYTN+B1B8lslzJaXa8V2qd1Iaj/UxiZWJ10yseCfWYX hCkA== MIME-Version: 1.0 X-Received: by 10.140.22.69 with SMTP id 63mr46944299qgm.23.1408308954809; Sun, 17 Aug 2014 13:55:54 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.229.64.196 with HTTP; Sun, 17 Aug 2014 13:55:54 -0700 (PDT) In-Reply-To: References: <20140817021822.9AEBE261C47@dd15934.kasserver.com> Date: Sun, 17 Aug 2014 21:55:54 +0100 X-Google-Sender-Auth: ztwaLS_C13B5C9HzXid1IZ6yoK4 Message-ID: To: David Zuelke Cc: Thomas Bley , "internals@lists.php.net" , Chris Wright , Park Framework Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Native support - PUT request, multipart form data From: cw@daverandom.com (Chris Wright) On 17 August 2014 11:49, David Zuelke wrote: > That does not make any sense; applications could accept XML, CSV or whate= ver else just as well. > > The original proposal is not very useful. $_GET contains parsed query str= ing info, $_POST contains parsed HTTP request body information if the media= type is application/x-www-urlencoded or multipart/form-data. Deserializing= that makes sense as the rules for it are in the HTTP spec. (warning: nitpicking) actually, neither of these types are part of the HTTP specification, the protocol specification doesn't deal with how to handle content, only how to transmit it. RFC 2616 makes no mention of it, and RFCs 7230-7235 don't either. > $_PUT/$_BODY/$_DATA would then have to contain the raw body contents, at = least if the media type isn't one of the above, for consistency. That'd sav= es the file_get_contents() call, and given how a request handler uses at mo= st once, I'm not sure such a change is worth it. I completely agree that there should be no special processing in the case of any content-type that is not already handled by $_POST, but I don't see the harm in handling those content types for arbitrary methods. Personally my ideal option would be to deprecate $_POST and $_GET in favour of $_BODY and $_QUERY, respectively, which would be populated the same way regardless of the request method (not just PUT and POST). Similarly $_FILES would be populated for any multipart/form-data request entity, regardless of request method. No other content type could be reasonably handled since there is ambiguity in how it would be handled (to take the alternate examples David mentioned, json_decode() has options and there are a million and one ways to handle XML). One might suggest having these configurable with ini options or runtime functions, but both of these would largely defeat the purpose of such automatic handling. I agree with Julien that this is not the sort of thing that should go into a point release, and if $_POST/$_GET were to be deprecated then this would be a change for 7, probably with removal not before 8. All that said, I personally don't find the requirement for writing 2 additional lines to parse the data such a huge burden. I'm not against it, but neither will I be particularly upset if it doesn't happen.