From 87acaf7917d5a776e792843a19bbddb49d312f54 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Aug 2024 17:10:26 +0900 Subject: [PATCH 1/3] docs: update comment --- system/Database/BaseBuilder.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index d7fdc35287a1..7cc2f033596e 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3169,14 +3169,14 @@ protected function compileWhereHaving(string $qbKey): string ) { continue; } - // $matches = array( - // 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 */ - // ); + // $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] !== '' && $matches[4] !== '0') { $protectIdentifiers = false; From 694b0319965f9561e50cb02807afc9fa1931fda9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Aug 2024 17:11:25 +0900 Subject: [PATCH 2/3] fix: remove uneeded if condition --- system/Database/BaseBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 7cc2f033596e..7202cbcc739e 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3178,7 +3178,7 @@ protected function compileWhereHaving(string $qbKey): string // 5 => ')' /* optional */ // ]; - if (isset($matches[4]) && $matches[4] !== '' && $matches[4] !== '0') { + if (isset($matches[4]) && $matches[4] !== '') { $protectIdentifiers = false; if (str_contains($matches[4], '.')) { $protectIdentifiers = true; From 9e97a0c6d444400630976df3c61ecea236b9bd3c Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 28 Aug 2024 17:17:40 +0900 Subject: [PATCH 3/3] refactor: break long lines --- system/Database/BaseBuilder.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index 7202cbcc739e..9d5a02db9f6e 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -3164,8 +3164,14 @@ 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*(.*(?