File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class Operator extends Validator
1414 /**
1515 * @var array<string, Document|array<string, mixed>>
1616 */
17- protected array $ attributes ;
17+ protected array $ attributes = [] ;
1818
1919 protected string $ message = 'Invalid operator ' ;
2020
@@ -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 :
You can’t perform that action at this time.
0 commit comments