From 642fa77af1a6eb217111bfdf8ca008143d7d49a7 Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sat, 21 Sep 2024 23:38:35 +0700 Subject: [PATCH 1/2] Fix Message: strtoupper(): Passing null in Security.php --- system/core/Security.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/system/core/Security.php b/system/core/Security.php index a21bf07..3528edc 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -220,8 +220,14 @@ public function __construct() */ public function csrf_verify() { + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == ''){ + $requestMethod = strtoupper((string) $_SERVER['REQUEST_METHOD']); + } else { + $requestMethod = ''; + } + // If it's not a POST request we will set the CSRF cookie - if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') { + if ($requestMethod !== 'POST') { return $this->csrf_set_cookie(); } From 8631db6ecc93bb959d17e9a1ca9062cc721b6bf0 Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sat, 21 Sep 2024 23:39:53 +0700 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20M=E1=BB=99t=20s=E1=BB=91=20l=E1=BB=97?= =?UTF-8?q?i=20khi=20ch=E1=BA=A1y=20tr=C3=AAn=20php8.2=20#63?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/core/Input.php | 4 ++-- system/core/Security.php | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/system/core/Input.php b/system/core/Input.php index 8b34943..dacd7db 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -907,8 +907,8 @@ public function is_cli_request() public function method($upper = FALSE) { return ($upper) - ? strtoupper($this->server('REQUEST_METHOD')) - : strtolower($this->server('REQUEST_METHOD')); + ? strtoupper((string) $this->server('REQUEST_METHOD')) + : strtolower((string) $this->server('REQUEST_METHOD')); } // ------------------------------------------------------------------------ diff --git a/system/core/Security.php b/system/core/Security.php index 3528edc..3733da5 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -220,14 +220,8 @@ public function __construct() */ public function csrf_verify() { - if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == ''){ - $requestMethod = strtoupper((string) $_SERVER['REQUEST_METHOD']); - } else { - $requestMethod = ''; - } - // If it's not a POST request we will set the CSRF cookie - if ($requestMethod !== 'POST') { + if (strtoupper((string) $_SERVER['REQUEST_METHOD']) !== 'POST') { return $this->csrf_set_cookie(); }