Skip to content

Commit 9a1d6f9

Browse files
committed
bug #23341 [DoctrineBridge][Security][Validator] do not validate empty values (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [DoctrineBridge][Security][Validator] do not validate empty values | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23319 | License | MIT | Doc PR | Nearly all validators operating on scalar values (except for some special constraints) do ignore empty values. If you want to forbid them, you have to use the `NotBlank` constraint instead. Commits ------- fd7ad234bc do not validate empty values
2 parents 7ebd830 + bebca95 commit 9a1d6f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function validate($value, Constraint $constraint)
4848
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\Url');
4949
}
5050

51-
if (null === $value) {
51+
if (null === $value || '' === $value) {
5252
return;
5353
}
5454

0 commit comments

Comments
 (0)