Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Validator] Improve regexp for Credit Cards and some more tests#6583
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for working on this. It would be very valuable if you can add information about these regexes as comments (with links to relevant sources -- like what you've done in the PR description). Thanks. |
The more information we can add in the class, the better it is. |
Can you keep the commit from#6603 to keep ownership? |
I actually have thought about that... let me try my git skills :) |
…non-numeric.Making scheme option accept strings in addition to arrays.
There you go! |
This PR was merged into the master branch.Commits-------5be0042 better regexp, more test cases, added comments about each credit cardcc278af [Validator] Fix `CardSchemeValidator` double violation when value is non-numeric. Making scheme option accept strings in addition to arrays.Discussion----------[Validator] Improve regexp for Credit Cards and some more testsBug fix: yesFeature addition: noBackwards compatibility break: noSymfony2 tests pass: yesFixes the following tickets:Todo: Ensure these regexps are proper (credit card validation is always a pain)License of the code: MITDocumentation PR:Regarding Cases excluded from new Regular Expressions:- Credit card lengths should be respected, these regexp cover lengths inhttp://en.wikipedia.org/wiki/Bank_card_number- Visa length can only be 16 and 13 (older ones)- Diners Cards starting by 5 come from a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard (according tohttp://www.regular-expressions.info/creditcard.html).- There seems to be JCB cards starting by 2131 and 1800, I could find them is some places, also found these numbers being tested in Credit Card generators, but some people don't cover them. I don't know their story eitherAny comments will be much appreciated!---------------------------------------------------------------------------by fabpot at 2013-01-06T19:33:27ZThanks for working on this. It would be very valuable if you can add information about these regexes as comments (with links to relevant sources -- like what you've done in the PR description). Thanks.---------------------------------------------------------------------------by ricardclau at 2013-01-06T21:01:52ZAlways glad to be able to contribute a little bit@fabpot you mean@link /@see PHPDoc inside CardSchemeValidator.php? Or further comments in this discussion before adding them?---------------------------------------------------------------------------by fabpot at 2013-01-06T21:16:48ZThe more information we can add in the class, the better it is.---------------------------------------------------------------------------by ricardclau at 2013-01-07T20:56:05ZI've added comments and included code from#6603 as I've said there. If you need something else, please let me know, once this is merged,#6603 can also be closed---------------------------------------------------------------------------by fabpot at 2013-01-07T21:41:40ZCan you keep the commit from#6603 to keep ownership?---------------------------------------------------------------------------by ricardclau at 2013-01-07T21:44:16ZI actually have thought about that... let me try my git skills :)---------------------------------------------------------------------------by ricardclau at 2013-01-07T21:59:16ZThere you go!
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo: Ensure these regexps are proper (credit card validation is always a pain)
License of the code: MIT
Documentation PR:
Regarding Cases excluded from new Regular Expressions:
Any comments will be much appreciated!