Bug #70576 [Csd]: On PUT/PATCH Methods all PHP file methods can read php://input just one time
| From: | mike@php.net | Date: | Fri, 25 Sep 2015 07:28:48 +0000 |
| Subject: | Bug #70576 [Csd]: On PUT/PATCH Methods all PHP file methods can read php://input just one time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196227@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70576&edit=1
ID: 70576
Updated by: mike@php.net
Reported by: chameleonbr at gmail dot com
Summary: On PUT/PATCH Methods all PHP file methods can read
php://input just one time
Status: Closed
Type: Bug
Package: Filesystem function related
Operating System: OpenSUSE 13.2
PHP Version: 5.5.29
Assigned To: mike
Block user comment: N
Private report: N
New Comment:
Also, if you'd like 'application/x-www-form-urlencoded' data to end up in
$_POST/$_REQUEST for request methods other than 'POST', have a look at ext-apfd: https://pecl.php.net/package/apfd
Previous Comments:
------------------------------------------------------------------------
[2015-09-24 23:51:37] requinix@php.net
This was fixed in PHP 5.6.
5.5 is now only receiving security fixes so please consider upgrading.
------------------------------------------------------------------------
[2015-09-24 20:50:59] chameleonbr at gmail dot com
Description:
------------
On HTTP PUT and PATCH Methods all PHP file methods can read php://input just one time.
In the method post 2 times the value appears as expected, but the put and patch methods returns only
one time.
Test script:
---------------
<?php
var_dump(file_get_contents('php://input'));
var_dump(file_get_contents('php://input'));
?>
Send DATA using HTTP POST and after HTTP PUT or PATCH.
Actual result:
--------------
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d
'var1=val2&var2=val2' 'http://localhost/testmethod.php'
result:
string(19) "var1=val2&var2=val2"
string(19) "var1=val2&var2=val2"
curl -X PUT -H "Content-Type: application/x-www-form-urlencoded" -d
'var1=val2&var2=val2' 'http://localhost/testmethod.php'
result:
string(19) "var1=val2&var2=val2"
string(0) ""
curl -X PATCH -H "Content-Type: application/x-www-form-urlencoded" -d
'var1=val2&var2=val2' 'http://localhost/testmethod.php'
result:
string(19) "var1=val2&var2=val2"
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70576&edit=1