From 298ff4a9d6f7e574354921628c6bf61c2932f43e Mon Sep 17 00:00:00 2001 From: 3Dgoo Date: Mon, 28 Mar 2022 06:59:25 +1030 Subject: [PATCH] Fix search form ending in dash error On the search form if a user's search ends in a dash it will cause a server error. This change fixes this problem by trimming dashes and spaces from the end of the search term. --- code/Search/SearchForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Search/SearchForm.php b/code/Search/SearchForm.php index cbe170f1b4..133a8668c1 100644 --- a/code/Search/SearchForm.php +++ b/code/Search/SearchForm.php @@ -146,7 +146,7 @@ public function getResults() } } - $keywords = $request->requestVar('Search'); + $keywords = rtrim($request->requestVar('Search'), '- '); $andProcessor = function ($matches) { return ' +' . $matches[2] . ' +' . $matches[4] . ' ';