Merge pull request #3 from kijin/php7

PHP7 호환성 개선
This commit is contained in:
CONORY 2015-12-18 14:15:15 +09:00
commit de0c54ff37
12 changed files with 24 additions and 20 deletions

View file

@ -200,9 +200,13 @@ class Context
*/
public function init()
{
// 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(simplexml_load_string(file_get_contents("php://input")) !== false) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
if(strpos($_SERVER['CONTENT_TYPE'], 'json') || strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json')) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
if(!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
{
unset($GLOBALS['HTTP_RAW_POST_DATA']);
}
}
// set context variables in $GLOBALS (to use in display handler)