Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69320 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13413 invoked from network); 24 Sep 2013 15:42:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Sep 2013 15:42:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=catch.dave@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=catch.dave@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.50 as permitted sender) X-PHP-List-Original-Sender: catch.dave@gmail.com X-Host-Fingerprint: 209.85.220.50 mail-pa0-f50.google.com Received: from [209.85.220.50] ([209.85.220.50:33711] helo=mail-pa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/10-12747-5E2B1425 for ; Tue, 24 Sep 2013 11:42:29 -0400 Received: by mail-pa0-f50.google.com with SMTP id fb1so3858653pad.37 for ; Tue, 24 Sep 2013 08:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=sFHpo4H8NSQLFLYnhOCcv4U7VSdxw6QE8dYg8jLCB+c=; b=c5yypDcOwG3V1XwtXpgHChCqBaTd6ej62MKnR++oGgIenWoNlrJCmkpQmPXhTMJ6w8 zSkoZpwODr8D2+fiCE1lj8hNeEhCXuWJqCm1UNFVghCTLH/Cj1Plfr5ZSWEGA7jA96cQ ZL/pXQ/0Jv53dJ7qKUQECeVCprR2pibXdXcUjN3a2iG+oQ1vS2OihsK4E1ooXTm+AQRY yEbvrXFnXvu4jCFG8QYFNJyyaCwAT/l3ZpVwBf/mjxLsdC80Y0ZV2xP2iAg5NQFVb53s Wb4FTJpGuy5age6UkJWg/sd1WwXQhKibTzx8FfZCoadZZY/ZwYbsn6EamVc1p9J25qJS iKew== X-Received: by 10.66.227.39 with SMTP id rx7mr29185887pac.44.1380037346626; Tue, 24 Sep 2013 08:42:26 -0700 (PDT) Received: from [10.229.105.159] (187.sub-174-254-225.myvzw.com. [174.254.225.187]) by mx.google.com with ESMTPSA id yh1sm41699624pbc.21.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Sep 2013 08:42:25 -0700 (PDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: multipart/alternative; boundary=Apple-Mail-E520E124-61E0-4493-BED6-918527E168AD Content-Transfer-Encoding: 7bit Message-ID: Cc: "internals@lists.php.net" , Ryan McCue , Tjerk Meesters X-Mailer: iPhone Mail (10B329) Date: Tue, 24 Sep 2013 08:42:20 -0700 To: Daniel Lowrey Subject: Re: Parsing PUT data From: catch.dave@gmail.com --Apple-Mail-E520E124-61E0-4493-BED6-918527E168AD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Thanks Daniel. My thoughts on your response: > Where does it stop? This is the problem I see with all the requests to sup= port for PUT similarly to POST.=20 Right here with PUT. Providing a RESTful interface is hugely common and $_PU= T is the only one missing to complete REST. PUT is the glaringly obvious one= missing.=20 > You could easily write a parser in userland to accomplish the same thing. I did originally. But it became obvious that (a) it's a common problem; (b) b= eing non-trivial, it would a require very wide set of test cases to ensure i= t won't break in some random edge case; and (c) the functionality already ex= ists for POST.=20 Other languages (Ruby, for example) make REST very easy. Multipart support f= or PUT was literally the only issue I personally encountered when writing a p= ublic REST API in PHP. Dave. On 24/09/2013, at 7:59, Daniel Lowrey wrote: > > In short, in order to provide a proper REST service that supports multip= art > > form data, we need someway to parse data sent via PUT (data is available= > > via php://input, but it needs to be parsed). >=20 > Multipart entity parsing is fairly straightforward. You could easily write= a parser in userland to accomplish the same thing. Unless you're doing a ve= ry high volume of CRUD via PUT the performance hit of doing this in userland= should be negligible. >=20 > That said, I think exposing a function to do this could be a useful additi= on, and since PHP already has code to parse these entities for POST requests= it shouldn't be too much work to expose that via something like a new mime_= multipart_parse() function. It's not really a priority for me, but you can p= robably find someone to work on this for you if you're not a C person. >=20 > The bigger issue here is that the superglobals are a leaky abstraction. An= y HTTP request method is allowed to have an entity body, so should we also c= reate $_PATCH and $_PUT and $_ZANZIBAR to handle less-frequently used reques= t methods? Where does it stop? This is the problem I see with all the reques= ts to support for PUT similarly to POST. PHP web SAPIs support 95% of the HT= TP use-cases people have, but the abstractions break down after that and con= tinuously bolting on support for individual scenarios beyond that would be a= mistake IMO. --Apple-Mail-E520E124-61E0-4493-BED6-918527E168AD--