mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Fix not recognizing POST arguments if Content-Type is wrongly set to application/json
This commit is contained in:
parent
03d2ab3a49
commit
f8b76b5571
1 changed files with 2 additions and 2 deletions
|
|
@ -225,12 +225,12 @@ class Context
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
// Fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above.
|
// Fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above.
|
||||||
if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
|
if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && !count($_FILES) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
|
||||||
{
|
{
|
||||||
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
|
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
|
||||||
|
|
||||||
// If content is not XML or JSON, unset
|
// If content is not XML or JSON, unset
|
||||||
if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
|
if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === false && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === false)
|
||||||
{
|
{
|
||||||
unset($GLOBALS['HTTP_RAW_POST_DATA']);
|
unset($GLOBALS['HTTP_RAW_POST_DATA']);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue