diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Segment/SegmentExpression.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/Segment/SegmentExpression.php b/core/Segment/SegmentExpression.php index 5f1a7fea27..605cd13682 100644 --- a/core/Segment/SegmentExpression.php +++ b/core/Segment/SegmentExpression.php @@ -279,7 +279,7 @@ class SegmentExpression // it can be used internally to inject sub-expressions into the query. // see Segment::getCleanedExpression() $sqlMatch = '%s IN (' . $value['SQL'] . ')'; - $value = $this->escapeLikeString($value['bind']); + $value = $value['bind']; break; default: throw new Exception("Filter contains the match type '" . $matchType . "' which is not supported"); @@ -337,8 +337,14 @@ class SegmentExpression */ private function escapeLikeString($str) { - $str = str_replace("%", "\%", $str); - $str = str_replace("_", "\_", $str); + if (false !== strpos($str, '%')) { + $str = str_replace("%", "\%", $str); + } + + if (false !== strpos($str, '_')) { + $str = str_replace("_", "\_", $str); + } + return $str; } |