From e35a4a1306d7fe0736d2f6ba3e0284308d29ebd0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 22 Mar 2022 14:32:32 +0300 Subject: tests: add stub autoloader, add a few more rewrite_relative tests --- classes/urlhelper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'classes/urlhelper.php') diff --git a/classes/urlhelper.php b/classes/urlhelper.php index 29a9528a8..57046b600 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -26,6 +26,7 @@ class UrlHelper { /** @var string */ static $fetch_last_modified; + /** @var string */ static $fetch_effective_url; @@ -68,6 +69,8 @@ class UrlHelper { $rel_parts = parse_url($rel_url); + if (!$rel_url) return $base_url; + /** * If parse_url failed to parse $rel_url return false to match the current "invalid thing" behavior * of UrlHelper::validate(). @@ -107,7 +110,7 @@ class UrlHelper { $rel_parts['host'] = $base_parts['host'] ?? ""; $rel_parts['scheme'] = $base_parts['scheme'] ?? ""; - if (isset($rel_parts['path'])) { + if ($rel_parts['path'] ?? false) { // we append dirname() of base path to relative URL path as per RFC 3986 section 5.2.2 $base_path = with_trailing_slash(dirname($base_parts['path'])); -- cgit v1.2.3-54-g00ecf