diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md new file mode 100644 index 000000000000..27a069cb1883 --- /dev/null +++ b/UPGRADE-3.4.md @@ -0,0 +1,8 @@ +UPGRADE FROM 3.3 to 3.4 +======================= + +Validator +--------- + + * not setting the `strict` option of the `Choice` constraint to `true` is + deprecated and will throw an exception in Symfony 4.0 diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index 4b040fd20318..ecfd8b090ed9 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -507,6 +507,9 @@ TwigBridge Validator --------- + * The default value of the `strict` option of the `Choice` constraint was changed + to `true`. Using any other value will throw an exception. + * The `DateTimeValidator::PATTERN` constant was removed. * `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in diff --git a/src/Symfony/Component/Validator/CHANGELOG.md b/src/Symfony/Component/Validator/CHANGELOG.md index 7099496cfa1d..e0e132938d0b 100644 --- a/src/Symfony/Component/Validator/CHANGELOG.md +++ b/src/Symfony/Component/Validator/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +3.4.0 +----- + + * not setting the `strict` option of the `Choice` constraint to `true` is + deprecated and will throw an exception in Symfony 4.0 + 3.3.0 ----- diff --git a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 6c81b3b4e0b2..ca114a4fef7f 100644 --- a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -58,8 +58,8 @@ public function validate($value, Constraint $constraint) $choices = $constraint->choices; } - if (false === $constraint->strict) { - @trigger_error('Setting the strict option of the Choice constraint to false is deprecated since version 3.2 and will be removed in 4.0.', E_USER_DEPRECATED); + if (true !== $constraint->strict) { + @trigger_error('Not setting the strict option of the Choice constraint to true is deprecated since version 3.4 and will throw an exception in 4.0.', E_USER_DEPRECATED); } if ($constraint->multiple) {