Upgrade to 3.6.2

This commit is contained in:
Bastian Allgeier
2022-02-01 11:42:39 +01:00
parent f62d1a39ca
commit 848ea36dcf
108 changed files with 2887 additions and 2622 deletions

View File

@@ -77,13 +77,13 @@ class Url
/**
* Tries to fix a broken url without protocol
*
* @param string $url
* @param string|null $url
* @return string
*/
public static function fix(string $url = null): string
{
// make sure to not touch absolute urls
return (!preg_match('!^(https|http|ftp)\:\/\/!i', $url)) ? 'http://' . $url : $url;
return (!preg_match('!^(https|http|ftp)\:\/\/!i', $url ?? '')) ? 'http://' . $url : $url;
}
/**
@@ -111,7 +111,7 @@ class Url
/**
* Checks if an URL is absolute
*
* @param string $url
* @param string|null $url
* @return bool
*/
public static function isAbsolute(string $url = null): bool
@@ -120,14 +120,14 @@ class Url
// //example.com/uri
// http://example.com/uri, https://example.com/uri, ftp://example.com/uri
// mailto:example@example.com, geo:49.0158,8.3239?z=11
return preg_match('!^(//|[a-z0-9+-.]+://|mailto:|tel:|geo:)!i', $url) === 1;
return $url !== null && preg_match('!^(//|[a-z0-9+-.]+://|mailto:|tel:|geo:)!i', $url) === 1;
}
/**
* Convert a relative path into an absolute URL
*
* @param string $path
* @param string $home
* @param string|null $path
* @param string|null $home
* @return string
*/
public static function makeAbsolute(string $path = null, string $home = null): string