Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78368 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94372 invoked from network); 27 Oct 2014 05:09:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2014 05:09:29 -0000 Authentication-Results: pb1.pair.com header.from=figureonecpr@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=figureonecpr@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.194 as permitted sender) X-PHP-List-Original-Sender: figureonecpr@gmail.com X-Host-Fingerprint: 209.85.212.194 mail-wi0-f194.google.com Received: from [209.85.212.194] ([209.85.212.194:61631] helo=mail-wi0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/95-56216-883DD445 for ; Mon, 27 Oct 2014 00:09:28 -0500 Received: by mail-wi0-f194.google.com with SMTP id ex7so2002886wid.1 for ; Sun, 26 Oct 2014 22:09:25 -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:content-transfer-encoding; bh=bYkoTUHO3flOYA2tZ6pe6FFMB7FeDNvVC83uhLCdNnU=; b=bpn5sLLdcewtcppf4MRb2geDwgj8iL/kY1Uhzoj9IqsdcQXbMXjZbErZzgHJOmIRMn Q3PLRYtRMCsc6i5M4btXbFqtkO3gXwX12P1Nd2rxKY/+XScYiCdUK3JuMAmx3auQxPIf r/t/NqjLZO55kyP5U5Y64FmmaLI5Z1ard2IwpXFZ2c/bymi359VuQBHjPtLdb2tIgCkH WMRE2fKqWDvVVrB3IGZgjC/awcq40iEZv6QPGrMD0/0w71lhmzUedqJrO+ONPmjfyfvN IqVC2lGWkLH5/rmcW+KfPwqwSAfp634Fa6H1KL33HCHZtjmiU1J91RYlHGQejN9Zuh7+ o6hw== MIME-Version: 1.0 X-Received: by 10.180.75.116 with SMTP id b20mr18063899wiw.49.1414386565311; Sun, 26 Oct 2014 22:09:25 -0700 (PDT) Received: by 10.216.194.132 with HTTP; Sun, 26 Oct 2014 22:09:25 -0700 (PDT) In-Reply-To: References: <776669CE-9E8C-4069-9834-C7275CCA0EF4@ajf.me> <8CB055D4-F164-4DF3-B019-684BAE7E016E@ajf.me> <543D47C1.9050009@lerdorf.com> <543D4CE1.5000109@lerdorf.com> <543D6864.10508@gmail.com> <543D85E6.2020507@lerdorf.com> <57b7a3681d6c2c7ae123c8921b2d19d6@mail.gmail.com> <544D65F7.8070807@sugarcrm.com> Date: Mon, 27 Oct 2014 01:09:25 -0400 Message-ID: To: Park Framework Cc: PHP internals list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] New globals for PUT and DELETE From: figureonecpr@gmail.com (Sanford Whiteman) > PUT, DELETE, must be available in a single global variable, the > variable name is not important > file_get_contents(=E2=80=98php://input') - uncomfortably If the quibble were with file_get_contents(=E2=80=98php://input') that's no= t sufficiently uncomfortable to warrant a new superglobal. I assume you mean parsing the contents of php://input into an associative array regardless of the content-type of the HTTP entity-body. However, you're glossing over the semantic difference between POSTing an entity-body and PUTing that same body. multipart/form-data is specified in RFC 1867 as POST-specific, with deliberate notes about expected server behavior. RFC 2388 expands form-data into a general mimetype regardless of transport, and theoretically regardless of HTTP method, but AFAIK there's no equivalent to 1867 that reasonably leads to auto-decoding PUT form-data into an associative array. Rather, the PUT payload has always been designed to _become_ the target resource, as-is. The POST payload is designed to be interpreted via the server's own semantics before changing any resource state. Thus there is a very strong reason to present POST data to the server in an easily accessible and mutable form. Not so for PUT. This doesn't mean PUT payloads must stay opaque to PHP, of course. If there's a need to validate the payload before overwriting the current resource state, that may require that it be passed through some binary image verification, validated against a DTD, or -- indeed -- decoded from multipart MIME into its parts for validation, even if it's the multipart representation that eventually gets stored. Yet if you feel that PUT content should be automatically decoded, you might as well apply this to other multipart content as well -- if I PUT an MHTML file or, as noted before, an RFC 822 e-mail, by this assumption those would also populate the new superglobal. Honestly if it didn't consume any extra resources to always populate, I wouldn't care. But to be unable to avoid decoding every giant multipart payload just because I _might_ want to look at the parts is highly inefficient. -- S.