From 74d7f88fae625f85a3d7677497605427d1d04d74 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 24 Jul 2022 14:50:03 +0300 Subject: [PATCH] make_self_url: properly strip out GET params --- classes/config.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/config.php b/classes/config.php index 6ebe31e2d..afb182440 100644 --- a/classes/config.php +++ b/classes/config.php @@ -465,9 +465,11 @@ class Config { /** generates reference self_url_path (no trailing slash) */ static function make_self_url() : string { $proto = self::is_server_https() ? 'https' : 'http'; - $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; + + $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); $self_url_path = preg_replace("/\w+\.php(\?.*$)?$/", "", $self_url_path); + #$self_url_path = preg_replace("/(\?.*$)?$/", "", $self_url_path); if (substr($self_url_path, -1) === "/") { return substr($self_url_path, 0, -1);