From ba58c8b225fbc019ffd06d7841419b6993d7095a Mon Sep 17 00:00:00 2001 From: Kong Jin Jie Date: Thu, 14 Apr 2022 14:04:32 +0800 Subject: [PATCH] Improving Constraint_check Validating check always expect string in `$value`. This fix is also accept arrays. --- code/ZenValidatorConstraint.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/ZenValidatorConstraint.php b/code/ZenValidatorConstraint.php index b6bc3fa..7cda442 100644 --- a/code/ZenValidatorConstraint.php +++ b/code/ZenValidatorConstraint.php @@ -379,7 +379,12 @@ public function removeParsley() public function validate($value) { - $array = array_filter(explode(',', $value)); + if (is_string($value)) { + $array = array_filter(explode(',', $value)); + } else { + $array = $value; + } + if (empty($array)) { return; //you should use required instead }