From ebcafaf897a4fd222a2acb5614a0e94d15bd6ea4 Mon Sep 17 00:00:00 2001 From: Aleksandr Yakovlev Date: Sun, 2 Jun 2024 16:33:10 +0600 Subject: [PATCH] Close off type errors in router --- framework/classes/engine/Router.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/classes/engine/Router.class.php b/framework/classes/engine/Router.class.php index 5e44f1e..f8c38c9 100644 --- a/framework/classes/engine/Router.class.php +++ b/framework/classes/engine/Router.class.php @@ -243,7 +243,7 @@ class Router extends LsObject */ protected function GetRequestUri() { - $sReq = preg_replace("/\/+/", '/', $_SERVER['REQUEST_URI']); + $sReq = preg_replace("/\/+/", '/', ($_SERVER['REQUEST_URI'] ?? '')); $sReq = preg_replace("/^\/(.*)\/?$/U", '\\1', $sReq); $sReq = preg_replace("/^(.*)\?.*$/U", '\\1', $sReq); /** @@ -469,8 +469,8 @@ class Router extends LsObject static public function GetFixPathWeb($sUrl, $bWithScheme = true) { $sResult = ''; - $aPathFull = parse_url($sUrl); - $sPath = preg_replace('/^(http|https):\/\/[^\/]+/i', '', $sUrl); + $aPathFull = parse_url((string) $sUrl); + $sPath = preg_replace('/^(http|https):\/\/[^\/]+/i', '', (string) $sUrl); if (isset($aPathFull['host'])) { $sHost = $aPathFull['host']; } elseif (isset($_SERVER['HTTP_HOST'])) { @@ -870,4 +870,4 @@ class Router extends LsObject { self::Location(self::GetPath($sLocation)); } -} \ No newline at end of file +}