Skip to content

Commit 664b451

Browse files
Update src/Database/Validator/Operator.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent d4cbc8d commit 664b451

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Database/Validator/Operator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,14 @@ private function validateOperatorForAttribute(
238238
case DatabaseOperator::TYPE_ARRAY_INTERSECT:
239239
case DatabaseOperator::TYPE_ARRAY_DIFF:
240240
if (!$isArray) {
241-
$this->message = "Cannot apply {$method} operator to non-array field '{$operator->getAttribute()}'";
241+
$this->message = "Cannot use {$method} operator on non-array attribute '{$operator->getAttribute()}'";
242242
return false;
243243
}
244244

245+
if (empty($values) || !\is_array($values[0])) {
246+
$this->message = "{$method} operator requires a non-empty array value";
247+
return false;
248+
}
245249

246250
break;
247251
case DatabaseOperator::TYPE_ARRAY_FILTER:

0 commit comments

Comments
 (0)