Skip to content

Commit c326cd1

Browse files
authored
Merge pull request #9157 from kenjis/refactor-BaseBuilder
refactor: BaseBuilder
2 parents 77f5e47 + 9e97a0c commit c326cd1

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

system/Database/BaseBuilder.php

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,21 +3164,27 @@ protected function compileWhereHaving(string $qbKey): string
31643164
);
31653165

31663166
foreach ($conditions as &$condition) {
3167-
if (($op = $this->getOperator($condition)) === false
3168-
|| ! preg_match('/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i', $condition, $matches)
3167+
$op = $this->getOperator($condition);
3168+
if (
3169+
$op === false
3170+
|| ! preg_match(
3171+
'/^(\(?)(.*)(' . preg_quote($op, '/') . ')\s*(.*(?<!\)))?(\)?)$/i',
3172+
$condition,
3173+
$matches
3174+
)
31693175
) {
31703176
continue;
31713177
}
3172-
// $matches = array(
3173-
// 0 => '(test <= foo)', /* the whole thing */
3174-
// 1 => '(', /* optional */
3175-
// 2 => 'test', /* the field name */
3176-
// 3 => ' <= ', /* $op */
3177-
// 4 => 'foo', /* optional, if $op is e.g. 'IS NULL' */
3178-
// 5 => ')' /* optional */
3179-
// );
3180-
3181-
if (isset($matches[4]) && $matches[4] !== '' && $matches[4] !== '0') {
3178+
// $matches = [
3179+
// 0 => '(test <= foo)', /* the whole thing */
3180+
// 1 => '(', /* optional */
3181+
// 2 => 'test', /* the field name */
3182+
// 3 => ' <= ', /* $op */
3183+
// 4 => 'foo', /* optional, if $op is e.g. 'IS NULL' */
3184+
// 5 => ')' /* optional */
3185+
// ];
3186+
3187+
if (isset($matches[4]) && $matches[4] !== '') {
31823188
$protectIdentifiers = false;
31833189
if (str_contains($matches[4], '.')) {
31843190
$protectIdentifiers = true;

0 commit comments

Comments
 (0)