Close off type errors in router

This commit is contained in:
Alexander Yakovlev 2024-06-02 16:33:10 +06:00
parent a7f5784aeb
commit ebcafaf897
Signed by: oreolek
GPG key ID: 8269E24B4008E32A

View file

@ -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));
}
}
}