From 6369266c7e5975dd01ff8ead35681f3d783e92fc Mon Sep 17 00:00:00 2001 From: Sergey Chernecov Date: Fri, 28 Aug 2015 17:15:43 +0300 Subject: [PATCH] In array validator should improvement. Without strict flag $result will be true, instead of false. $value = true; $result = in_array($value, ['a', 'b']); --- Validator/Constraints/InArrayValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validator/Constraints/InArrayValidator.php b/Validator/Constraints/InArrayValidator.php index 9ee06c3..e6a1adb 100644 --- a/Validator/Constraints/InArrayValidator.php +++ b/Validator/Constraints/InArrayValidator.php @@ -28,7 +28,7 @@ public function validate($value, Constraint $constraint) if (!$constraint instanceof InArray) { throw new \Exception('This constraint must be instance of EcentriaRestBundle:InArray'); } - if (!in_array($value, $constraint->values)) { + if (!in_array($value, $constraint->values, true)) { $this->context->addViolation( sprintf( "Value '%s' is not supported. Possible values: \"'%s'\"",