diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 612e29e3fa..3b9cae51ce 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -200,6 +200,10 @@ function Context() */ function init() { + if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) { + $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); + } + // set context variables in $GLOBALS (to use in display handler) $this->context = &$GLOBALS['__Context__']; $this->context->lang = &$GLOBALS['lang']; @@ -1145,7 +1149,7 @@ function setRequestMethod($type = '') ($type && $self->request_method = $type) or ((strpos($_SERVER['CONTENT_TYPE'], 'json') || strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json')) && $self->request_method = 'JSON') or - (file_get_contents('php://input') && $self->request_method = 'XMLRPC') or + ($GLOBALS['HTTP_RAW_POST_DATA'] && $self->request_method = 'XMLRPC') or ($self->js_callback_func && $self->request_method = 'JS_CALLBACK') or ($self->request_method = $_SERVER['REQUEST_METHOD']); } @@ -1249,7 +1253,7 @@ function _setJSONRequestArgument() } $params = array(); - parse_str(file_get_contents('php://input'), $params); + parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); foreach($params as $key => $val) { @@ -1269,7 +1273,7 @@ function _setXmlRpcArgument() return; } - $xml = file_get_contents('php://input'); + $xml = $GLOBALS['HTTP_RAW_POST_DATA']; if(Security::detectingXEE($xml)) { header("HTTP/1.0 400 Bad Request");