summaryrefslogtreecommitdiff
path: root/classes/urlhelper.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-03-22 14:32:32 +0300
committerAndrew Dolgov <[email protected]>2022-03-22 14:32:32 +0300
commite35a4a1306d7fe0736d2f6ba3e0284308d29ebd0 (patch)
tree03c9b765938c1fdabf55b40bc1247af2b2b6d9b0 /classes/urlhelper.php
parent1c4f7ab3b838b23afb2ee4dab14acbf75956e952 (diff)
tests: add stub autoloader, add a few more rewrite_relative tests
Diffstat (limited to 'classes/urlhelper.php')
-rw-r--r--classes/urlhelper.php5
1 files changed, 4 insertions, 1 deletions
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']));