Skip to content

Commit 5451bca

Browse files
committed
Validate conditions when making a query.
1 parent 269ea47 commit 5451bca

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/QueryBuilderParser/QBPFunctions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ protected function operatorIsNull($operator)
9595
*/
9696
protected function validateCondition($condition)
9797
{
98+
if (is_null($condition)) {
99+
return $condition;
100+
}
101+
98102
$condition = trim(strtolower($condition));
99103

100104
if ($condition !== 'and' && $condition !== 'or') {

src/QueryBuilderParser/QueryBuilderParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ protected function makeQuery(Builder $query, stdClass $rule, $queryCondition = '
216216
/*
217217
* Ensure that the value is correct for the rule, return query on exception
218218
*/
219+
$this->validateCondition($queryCondition);
219220
try {
220221
$value = $this->getValueForQueryFromRule($rule);
221222
} catch (QBRuleException $e) {

0 commit comments

Comments
 (0)