Re: New globals for PUT and DELETE

From: Date: Wed, 15 Oct 2014 21:14:32 +0000
Subject: Re: New globals for PUT and DELETE
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-78098@lists.php.net to get a copy of this message
I'm not sure I understand what you're trying to do, could you explain in more detail with examples?
PUT /url Content-type: application/x-www-form-urlencoded parse_str (file_get_contents(‘php://input'), $_POST) // Ok PUT /url Content-type: multipart/mixed; boundary="xxxx" file_get_contents(‘php://input') // Empty string
You are missing information in your example. First, PHP doesn't do content negotiation for every Content-Type known to send serialized data, it is extremely selective in that AFAIK, url/form encoded Content-Types, when POSTed, will be content-negotiated, parsed, and their resultant will populate the $_POST superglobal. Moreover, your 2nd example does not suggest that an HTTP request was sent with a body to demonstrate there is a bug here. With a php script being served at index.php with the following contents: <?php var_dump(file_get_contents('php://input')); Here is a demonstration of this script, and a successful read of the request body: $ echo 'FOOOO=BARRRRR' | http --verbose PUT localhost:8000 \
    Content-Type:'multipart/mime; boundry=xxxxx'
PUT / HTTP/1.1 Accept: application/json Accept-Encoding: gzip, deflate Content-Length: 14 Content-Type: multipart/mime; boundry=xxxxx Host: localhost:8000 User-Agent: HTTPie/0.8.0 FOOOO=BARRRRR HTTP/1.1 200 OK Connection: close Content-type: text/html Host: localhost:8000 X-Powered-By: PHP/5.5.15 string(14) "FOOOO=BARRRRR " -ralph

« previous php.internals (#78098) next »