diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index d7fdc35287a1..9d5a02db9f6e 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3164,21 +3164,27 @@ protected function compileWhereHaving(string $qbKey): string ); foreach ($conditions as &$condition) { - if (($op = $this->getOperator($condition)) === false - || ! preg_match('/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?getOperator($condition); + if ( + $op === false + || ! preg_match( + '/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(? '(test <= foo)', /* the whole thing */ - // 1 => '(', /* optional */ - // 2 => 'test', /* the field name */ - // 3 => ' <= ', /* $op */ - // 4 => 'foo', /* optional, if $op is e.g. 'IS NULL' */ - // 5 => ')' /* optional */ - // ); - - if (isset($matches[4]) && $matches[4] !== '' && $matches[4] !== '0') { + // $matches = [ + // 0 => '(test <= foo)', /* the whole thing */ + // 1 => '(', /* optional */ + // 2 => 'test', /* the field name */ + // 3 => ' <= ', /* $op */ + // 4 => 'foo', /* optional, if $op is e.g. 'IS NULL' */ + // 5 => ')' /* optional */ + // ]; + + if (isset($matches[4]) && $matches[4] !== '') { $protectIdentifiers = false; if (str_contains($matches[4], '.')) { $protectIdentifiers = true;