Fix operator in wildcard filter chains

This commit is contained in:
Eric Lippmann 2019-08-13 17:19:45 +02:00
parent 214a34a5a8
commit c8ed889114
1 changed files with 3 additions and 1 deletions

View File

@ -312,17 +312,19 @@ class DbQuery extends SimpleQuery
if (! empty($comp)) {
$sql[] = $col . ' IN (' . $this->escapeForSql($comp) . ')';
}
$operator = 'OR';
} elseif ($sign === '!=') {
if (! empty($comp)) {
$sql[] = sprintf('(%1$s NOT IN (%2$s) OR %1$s IS NULL)', $col, $this->escapeForSql($comp));
}
$operator = 'AND';
} else {
throw new QueryException(
'Unable to render array expressions with operators other than equal or not equal'
);
}
return '(' . implode(' OR ', $sql) . ')';
return '(' . implode(" $operator ", $sql) . ')';
} elseif ($sign === '=' && strpos($expression, '*') !== false) {
if ($expression === '*') {
return new Zend_Db_Expr('TRUE');