diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index a2c407194ed2..51066398be33 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -663,8 +663,6 @@ protected function whereHaving(string $qbKey, $key, $value = null, string $type } } - $bind = $this->setBind($k, $v, $escape); - if (empty($op)) { $op = ' ='; } else { @@ -675,7 +673,8 @@ protected function whereHaving(string $qbKey, $key, $value = null, string $type $builder = $this->cleanClone(); $v = '(' . str_replace("\n", ' ', $v($builder)->getCompiledSelect()) . ')'; } else { - $v = " :{$bind}:"; + $bind = $this->setBind($k, $v, $escape); + $v = " :{$bind}:"; } } elseif (! $this->hasOperator($k) && $qbKey !== 'QBHaving') { // value appears not to have been set, assign the test to IS NULL