@@ -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