aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_content.php4
-rw-r--r--tests/functions_content/phpbb_clean_search_string_test.php2
2 files changed, 4 insertions, 2 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 69a29dc31b..19459239d5 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -372,9 +372,9 @@ function phpbb_clean_search_string($search_string)
{
// This regular expressions matches every single wildcard.
// That means one after a whitespace or the beginning of the string or one before a whitespace or the end of the string.
- $search_string = preg_replace('#(?<=^|\s)\*(?=\s|$)#', '', $search_string);
+ $search_string = preg_replace('#(?<=^|\s)\*+(?=\s|$)#', '', $search_string);
$search_string = trim($search_string);
- $search_string = preg_replace('#\s+#u', ' ', $search_string);
+ $search_string = preg_replace(array('#\s+#u', '#\*+#u'), array(' ', '*'), $search_string);
return $search_string;
}
diff --git a/tests/functions_content/phpbb_clean_search_string_test.php b/tests/functions_content/phpbb_clean_search_string_test.php
index 3706ffedf9..fef9b5e9ea 100644
--- a/tests/functions_content/phpbb_clean_search_string_test.php
+++ b/tests/functions_content/phpbb_clean_search_string_test.php
@@ -24,6 +24,8 @@ class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_
array('* *test*', '*test*'),
array('test test * test', 'test test test'),
array(' some wild*cards * between wo*rds ', 'some wild*cards between wo*rds'),
+ array(' we * now have*** multiple wild***cards * ', 'we now have* multiple wild*cards'),
+ array('pi is *** . * **** * *****', 'pi is .'),
);
}