summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorwn <[email protected]>2020-12-12 09:47:10 -0600
committerwn <[email protected]>2020-12-12 10:28:47 -0600
commit08a6f6bde20055de5a08ea8afed5097783a5f164 (patch)
treea8c34730acfda972f13c015271108fb56e34c57c /include
parent75536b4790a676bf9ffffc115d2ec5fbf9a090b4 (diff)
Only do sanity checks for self URL if we can create a valid URL.
'sanity_check.php' gets included in 'update.php' and 'update_daemon2.php', where a Host request header is likely not provided.
Diffstat (limited to 'include')
-rwxr-xr-xinclude/sanity_check.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/sanity_check.php b/include/sanity_check.php
index 86dc7a5f0..e6c0e5d4b 100755
--- a/include/sanity_check.php
+++ b/include/sanity_check.php
@@ -21,6 +21,8 @@
}
function make_self_url_path() {
+ if (!isset($_SERVER["HTTP_HOST"])) return false;
+
$proto = is_server_https() ? 'https' : 'http';
$url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
@@ -115,14 +117,18 @@
}
$ref_self_url_path = make_self_url_path();
- $ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
+
+ if ($ref_self_url_path) {
+ $ref_self_url_path = preg_replace("/\w+\.php$/", "", $ref_self_url_path);
+ }
if (SELF_URL_PATH == "http://example.org/tt-rss/") {
+ $hint = $ref_self_url_path ? "(possible value: <b>$ref_self_url_path</b>)" : "";
array_push($errors,
- "Please set SELF_URL_PATH to the correct value for your server (possible value: <b>$ref_self_url_path</b>)");
+ "Please set SELF_URL_PATH to the correct value for your server $hint");
}
- if (isset($_SERVER["HTTP_HOST"]) &&
+ if ($ref_self_url_path &&
(!defined('_SKIP_SELF_URL_PATH_CHECKS') || !_SKIP_SELF_URL_PATH_CHECKS) &&
SELF_URL_PATH != $ref_self_url_path && SELF_URL_PATH != mb_substr($ref_self_url_path, 0, mb_strlen($ref_self_url_path)-1)) {
array_push($errors,