From 5d52df9c9aff150aaeb68bcc18990aa5a5b8196c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 16 Sep 2025 14:26:34 +0900 Subject: [PATCH] Use empty() instead of simple ! to check superglobals --- classes/context/Context.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index f4498857b..0c9f71190 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -1218,7 +1218,7 @@ class Context else { // Set HTTP_RAW_POST_DATA for third-party apps that look for it. - if (!$_POST && !isset($GLOBALS['HTTP_RAW_POST_DATA'])) + if (empty($_POST) && empty($_FILES) && !isset($GLOBALS['HTTP_RAW_POST_DATA'])) { $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); } @@ -1234,7 +1234,7 @@ class Context } // Decide whether it's JSON or XMLRPC by looking at the first character of the POST data. - if (!$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) + if (empty($_POST) && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) { self::$_instance->request_method = substr($GLOBALS['HTTP_RAW_POST_DATA'], 0, 1) === '<' ? 'XMLRPC' : 'JSON'; return; @@ -1262,7 +1262,7 @@ class Context } // Set JSON and XMLRPC arguments. - if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && !$_POST && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) + if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST) && !empty($GLOBALS['HTTP_RAW_POST_DATA'])) { $params = array(); $request_method = self::getRequestMethod();