DbConnection: Ensure compat with PHP 8.1 in `renderFilterExpression`

This commit is contained in:
Johannes Meyer 2022-05-13 11:51:45 +02:00
parent 03e7041ccb
commit 644d5eaba7
1 changed files with 2 additions and 2 deletions

View File

@ -579,13 +579,13 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
} }
return count($sql) === 1 ? $sql[0] : '(' . implode(" $operator ", $sql) . ')'; return count($sql) === 1 ? $sql[0] : '(' . implode(" $operator ", $sql) . ')';
} elseif ($filter instanceof FilterMatch && strpos($value, '*') !== false) { } elseif ($filter instanceof FilterMatch && $value !== null && strpos($value, '*') !== false) {
if ($value === '*') { if ($value === '*') {
return $column . ' IS NOT NULL'; return $column . ' IS NOT NULL';
} }
return $column . ' LIKE ' . $this->dbAdapter->quote(preg_replace('~\*~', '%', $value)); return $column . ' LIKE ' . $this->dbAdapter->quote(preg_replace('~\*~', '%', $value));
} elseif ($filter instanceof FilterMatchNot && strpos($value, '*') !== false) { } elseif ($filter instanceof FilterMatchNot && $value !== null && strpos($value, '*') !== false) {
if ($value === '*') { if ($value === '*') {
return $column . ' IS NULL'; return $column . ' IS NULL';
} }