Skip to content

Commit

Permalink
PHP 호환성 개선
Browse files Browse the repository at this point in the history
- $HTTP_RAW_POST_DATA
- $_SERVER['HTTP_CONTENT_TYPE']
  • Loading branch information
bnu committed May 18, 2015
1 parent 2579042 commit 80ab9df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions classes/context/Context.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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']);
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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");
Expand Down

0 comments on commit 80ab9df

Please sign in to comment.