[ticket/17365] Add spaces before +, -, and | to correct keyword count.

Prevents keyword limit being bypassed with the use of `+`, `-` and `|` in search queries, because $num_keywords depends on spaces to count the number of words.
This commit is contained in:
crowjake 2024-07-06 00:50:12 +01:00 committed by GitHub
parent 48a233e415
commit f03453c063
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -289,6 +289,7 @@ class fulltext_native extends \phpbb\search\base
'#(\+|\-)(?:\+|\-)+#', '#(\+|\-)(?:\+|\-)+#',
'#\(\|#', '#\(\|#',
'#\|\)#', '#\|\)#',
'#(?<!\s)(\+|\-|\|)#',
); );
$replace = array( $replace = array(
' ', ' ',
@ -296,6 +297,7 @@ class fulltext_native extends \phpbb\search\base
'$1', '$1',
'(', '(',
')', ')',
' $1',
); );
$keywords = preg_replace($match, $replace, $keywords); $keywords = preg_replace($match, $replace, $keywords);