Bug #74438 [Opn->Nab]: $_REQUEST/$_POST not populated
| From: | daverandom@php.net | Date: | Fri, 14 Apr 2017 11:31:20 +0000 |
| Subject: | Bug #74438 [Opn->Nab]: $_REQUEST/$_POST not populated | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208546@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74438&edit=1
ID: 74438
Updated by: daverandom@php.net
Reported by: ulimetic at hotmail dot com
Summary: $_REQUEST/$_POST not populated
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Win 7 x64
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
PHP does not decode JSON to populate POST, nor are there any plans to do so, nor does this
particular make sense (JSON is not necessarily an associative array, and populating $_POST with data
that is not an associative array would be surprising behaviour).
Previous Comments:
------------------------------------------------------------------------
[2017-04-14 11:23:03] ulimetic at hotmail dot com
Description:
------------
From client in CURL:
$ch = curl_init();
$data = '{"test":"hello"}';
curl_setopt($ch, CURLOPT_URL, 'http://localhost');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json',
'Content-Length: '.strlen($data)]);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$output = curl_exec($ch);
var_dump($output);
curl_close($ch);
From server
var_dump($_SERVER["CONTENT_TYPE"], $_REQUEST, $_POST);
//"string(16) "application/json" array(0) { } array(0) { } "
But file_get_contents("php://input") is populated
Tied the same with an Ajax call and the result is identical
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74438&edit=1