-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Add allowSpaces and allowLowerCase option in IBAN/BIC constraints #30272
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
Conversation
e9c8b35
to
2b18040
Compare
src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php
Outdated
Show resolved
Hide resolved
You could validate a BIC and IBAN against each other, is it still possible when using different options on BIC and IBAN? |
2b18040
to
2c61afe
Compare
Tests certainly failed due to merge in twig repo, maybe twigphp/Twig#2848 ? |
I've been checking the case-sensitivity details for BIC and IBAN, which is surprisingly hard to find:
So, I don't think we should make the case-sensitive behavior an option. This is a BIC + IBAN validator ... we cannot change those standards to validate what we want. |
So perhaps it's better to leverage #26484 in userland.. |
Always the same story: are validators also normalizers? If one wants to validate that it has only already normalized values in their db, then the check would be case sensitive and it should fail on whitespaces. Now, if one wants to accept user input and be robust (following the robustness principle), then the validator should accept both spaces and lowercase letters, and normalize them to uppercase+spaceless. Both approaches are valid. Which domain is covered by this class? |
A validator should only validate the official way. So, adding options to deviate from that is a no go to me. |
Thank you @alamirault |
This PR allow to add options for BIC and IBAN constraints. I added allowSpaces and allowLowerCase options.
By default BIC allow spaces and disallow lower case, IBAN allow spaces and allow lower case.
It not same in order to avoid BC.