From a1dd387bdc56179106a9bd7160476c0aca106179 Mon Sep 17 00:00:00 2001 From: IanM Date: Fri, 5 Jan 2024 10:38:38 +0000 Subject: [PATCH] handle malformed uri --- framework/core/src/Forum/Controller/LogOutController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Forum/Controller/LogOutController.php b/framework/core/src/Forum/Controller/LogOutController.php index cf594796d3..120b379e60 100644 --- a/framework/core/src/Forum/Controller/LogOutController.php +++ b/framework/core/src/Forum/Controller/LogOutController.php @@ -130,7 +130,11 @@ protected function sanitizeReturnUrl(string $url, string $base): Uri return new Uri($base); } - $parsedUrl = new Uri($url); + try { + $parsedUrl = new Uri($url); + } catch (\InvalidArgumentException $e) { + return new Uri($base); + } if (in_array($parsedUrl->getHost(), $this->getWhitelistedRedirectDomains())) { return $parsedUrl;