[ticket/security/235] Remove non trailing wildcards from search keywords

Database indexes are only used if wildcards are used at the end.
SECURITY-235
This commit is contained in:
Derky 2019-04-25 21:51:04 +02:00
parent 56060caa4c
commit fd195fba21

View file

@ -305,6 +305,11 @@ class fulltext_native extends \phpbb\search\base
}
}
// Remove non trailing wildcards from each word to prevent a full table scan (it's now using the database index)
$match = '#\*(?!$)\b#';
$replace = '$1';
$keywords = preg_replace($match, $replace, $keywords);
// set the search_query which is shown to the user
$this->search_query = $keywords;