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

View File

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