Skip to content

Commit

Permalink
Fix search issue with special characters, and escape them in SQL. s9y…
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeValadas committed Jul 16, 2024
1 parent f81f672 commit c0f7f16
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/functions_entries.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
$term = str_replace('"', '"', $term);
$relevance_enabled = true;
if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) {
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term' IN BOOLEAN MODE)";
$term = mysqli_real_escape_string($serendipity['dbConn'], $term);
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('\"$term\"' IN BOOLEAN MODE)";
} else {
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term')";
}
Expand Down

0 comments on commit c0f7f16

Please sign in to comment.