From 2a3e3ecc72417a7bffbbc572d69282fae571668b Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Fri, 18 Jul 2025 10:40:57 +0200 Subject: prevent php warnings, fixes #5723 Closes #5723 Merge request studip/studip!4368 --- app/controllers/terms.php | 2 +- lib/functions.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/terms.php b/app/controllers/terms.php index 528859a..9784a1c 100644 --- a/app/controllers/terms.php +++ b/app/controllers/terms.php @@ -71,7 +71,7 @@ class TermsController extends AuthenticatedController { $url = Config::get()->TERMS_OF_USE_URL; - if (is_internal_url($url)) { + if ($url && is_internal_url($url)) { $url_parts = explode('/', $url); $detail_id = $url_parts[4]; $si = new Siteinfo(); diff --git a/lib/functions.php b/lib/functions.php index 0849162..3198cb1 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -819,7 +819,7 @@ function is_internal_url($url) return mb_strpos($url, $GLOBALS['ABSOLUTE_URI_STUDIP']) === 0; } - if ($url[0] === '/') { + if (str_starts_with($url, '/')) { return mb_strpos($url, $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']) === 0; } -- cgit v1.0