-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
BicValidator add strict mode to validate bics in strict mode #54879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BicValidator add strict mode to validate bics in strict mode #54879
Conversation
What about adding a |
c460395
to
1b7bc67
Compare
// should contain uppercase characters only | ||
if (strtoupper($canonicalize) !== $canonicalize) { | ||
// should contain uppercase characters only in strict mode | ||
if (Bic::VALIDATION_MODE_STRICT === $constraint->mode && strtoupper($canonicalize) !== $canonicalize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xabbuh I changed it now to mode, the way that was also done in the email validator, because i need id here for the check. With the normalizer way i wouldn't know to check this or not.
1b7bc67
to
a28b5e6
Compare
Another way would be to always uppercase the value, right? |
@fabpot exactly. But this could break other applications when the application trusts,that the input is always validated to be upper case. Or do you mean to always manipulate the input to go ahead with upper case? I would not recommend to change/manipulate the input in a validator at least without having a solution to change the behavior as a developer. |
Thank you @maxbeckers. |
Add a strict mode for bic validation (default strict, behavior before the pr is strict). But it is possible to set strict to
false
to allow lowercase input.I'll add it to the docs when this PR is merged.