diff --git a/src/Symfony/Component/Validator/Constraints/AllValidator.php b/src/Symfony/Component/Validator/Constraints/AllValidator.php index a5eb32bbd9796..fcbd5b6de0de0 100644 --- a/src/Symfony/Component/Validator/Constraints/AllValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AllValidator.php @@ -34,7 +34,7 @@ public function validate($value, Constraint $constraint) } if (!is_array($value) && !$value instanceof \Traversable) { - throw new UnexpectedTypeException($value, 'array or Traversable'); + return; } $context = $this->context; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php index 2792dc4014a73..8ac30a718188b 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php @@ -31,12 +31,9 @@ public function testNullIsValid() $this->assertNoViolation(); } - /** - * @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testThrowsExceptionIfNotTraversable() + public function testNotTraversableIsValid() { - $this->validator->validate('foo.barbar', new All(new Range(array('min' => 4)))); + $this->assertNull($this->validator->validate('foo.barbar', new All(new Range(array('min' => 4))))); } /**
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: