Skip to content

Commit c0f7f16

Browse files
Fix search issue with special characters, and escape them in SQL. s9y#844
1 parent f81f672 commit c0f7f16

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/functions_entries.inc.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,8 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
883883
$term = str_replace('"', '"', $term);
884884
$relevance_enabled = true;
885885
if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) {
886-
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)";
886+
$term = mysqli_real_escape_string($serendipity['dbConn'], $term);
887+
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('\"$term\"' IN BOOLEAN MODE)";
887888
} else {
888889
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term')";
889890
}

0 commit comments

Comments
 (0)