Skip to content

Commit

Permalink
Fix issue 62 Error with apostrophe
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoTsuyuki committed Apr 29, 2022
1 parent f63cf94 commit 5af1c59
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 5af1c59

Please sign in to comment.