@@ -3164,21 +3164,27 @@ protected function compileWhereHaving(string $qbKey): string
3164
3164
);
3165
3165
3166
3166
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
+ )
3169
3175
) {
3170
3176
continue ;
3171
3177
}
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 ] !== '' ) {
3182
3188
$ protectIdentifiers = false ;
3183
3189
if (str_contains ($ matches [4 ], '. ' )) {
3184
3190
$ protectIdentifiers = true ;
0 commit comments