Skip to content

Commit

Permalink
Merge pull request #2 from TomoTsuyuki/fix-issue62-apostrophe
Browse files Browse the repository at this point in the history
Fix issue 62 Error with apostrophe
  • Loading branch information
Matt P authored May 5, 2022
2 parents f63cf94 + 5af1c59 commit 0e66a15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/filters/fuserfield/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ private function sql_replace($filtersearchtext, $filterstrmatch, $finalelements)
print_error('nosuchoperator');
}
if ($operator == '~') {
$replace = " AND " . $field . " LIKE '%" . $filtersearchtext . "%'";
$searchitem = trim(str_replace("'", "''", $filtersearchtext));
$replace = " AND " . $field . " LIKE '%" . $searchitem . "%'";
} else if ($operator == 'in') {
$processeditems = array();
// Accept comma-separated values, allowing for '\,' as a literal comma.
Expand Down
3 changes: 2 additions & 1 deletion components/filters/searchtext/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ private function sql_replace($filtersearchtext, $filterstrmatch, $finalelements)
print_error('nosuchoperator');
}
if ($operator == '~') {
$replace = " AND " . $field . " LIKE '%" . $filtersearchtext . "%'";
$searchitem = trim(str_replace("'", "''", $filtersearchtext));
$replace = " AND " . $field . " LIKE '%" . $searchitem . "%'";
} else if ($operator == 'in') {
$processeditems = array();
// Accept comma-separated values, allowing for '\,' as a literal comma.
Expand Down

0 comments on commit 0e66a15

Please sign in to comment.