Req #55815 [Com]: PUT request data should be parsed just like POST

From: Date: Fri, 05 Oct 2018 08:23:17 +0000
Subject: Req #55815 [Com]: PUT request data should be parsed just like POST
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217431@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55815&edit=1

 ID:                 55815
 Comment by:         a at anze dot com
 Reported by:        catch dot dave at gmail dot com
 Summary:            PUT request data should be parsed just like POST
 Status:             Open
 Type:               Feature/Change Request
 Package:            Streams related
 Operating System:   All
 PHP Version:        5.4.0beta1
 Block user comment: N
 Private report:     N

 New Comment:

Was there any development to allow multipart/form-data on PATCH, PUT, DELETE.. type of requests?

PHP is not suitable for RESTful API development not having this supported.


Previous Comments:
------------------------------------------------------------------------
[2015-10-02 13:01:47] carsten at bleicker dot de

Parse body for any kind of requests.
Keep old superglobals, make them deprecated [get,post]
Introduce http_request_body_raw, http_request_body_parsed, http_request_arguments.
Its realy bad currently having no chance getting the request body for a patch request, f.e.
we definitly need proper http handling for the http-api world.

------------------------------------------------------------------------
[2015-05-31 04:08:03] drew at funkhaus dot us

Ember Data uses PUT when updating a REST API endpoint. It sends it as form-data.

PHP not working with PUT or DELETE means you can't use Ember Data, and thus big parts of the
Ember framework.

I'd love it if PHP had someway of parsing PUT or the other HTTP methods. Currently I have to
write a bunch of regex, which sucks.

------------------------------------------------------------------------
[2015-04-13 16:27:10] mike@php.net

Related To: Bug #61439

------------------------------------------------------------------------
[2015-04-13 16:20:59] mike@php.net

See also https://pecl.php.net/package/apfd

------------------------------------------------------------------------
[2014-10-20 17:41:24] googleguy@php.net

I think I have a better solution that should satisfy everyone involved.

I'm going to propose an RFC for PHP 7 that enables PHP user-land to implement an HttpRequest
interface, which will make it possible to override PHP's normal behavior for handling the
incoming HTTP request in whatever way they deem necessary.

This will mean doing away with GPCS superglobals altogether and have an HttpRequest object that will
handle the entire request process. Superglobal variables like $_GET and $_POST are confusing and
misleading, because they don't actually speak to the HTTP request VERB used in the request. So
the actual request processing should be delegated to a class that implements an HttpRequest
interface instead and the request can be handled directly by that class. To maintain default
behavior we should implement a default HttpRequest class and people will be able to extend that
class to override default behaviors (such as in the case of wanting to handle PUT requests
differently than PHP handles them right now).

Since this breaks backwards compatibility in a major way I think the proposed changes for PHP 7
should be OK.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=55815


--
Edit this bug report at https://bugs.php.net/bug.php?id=55815&edit=1


Thread (28 messages)

« previous php.bugs (#217431) next »