Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit8729026
committed
merged branch ricardclau/improve-creditcard-regexp (PR#6583)
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!File tree
2 files changed
+108
-18
lines changed- src/Symfony/Component/Validator
- Constraints
- Tests/Constraints
2 files changed
+108
-18
lines changedLines changed: 53 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | | - | |
| 31 | + | |
28 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | | - | |
| 38 | + | |
31 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 46 | + | |
36 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
42 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
43 | 61 | | |
44 | | - | |
| 62 | + | |
45 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
46 | 68 | | |
47 | | - | |
| 69 | + | |
48 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
49 | 74 | | |
50 | | - | |
| 75 | + | |
51 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
52 | 81 | | |
53 | | - | |
| 82 | + | |
54 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
55 | 87 | | |
56 | | - | |
| 88 | + | |
57 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
58 | 93 | | |
59 | | - | |
| 94 | + | |
60 | 95 | | |
61 | 96 | | |
62 | 97 | | |
| |||
74 | 109 | | |
75 | 110 | | |
76 | 111 | | |
| 112 | + | |
| 113 | + | |
77 | 114 | | |
78 | 115 | | |
79 | | - | |
| 116 | + | |
80 | 117 | | |
81 | 118 | | |
82 | 119 | | |
| |||
Lines changed: 55 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
60 | 71 | | |
61 | 72 | | |
62 | 73 | | |
63 | 74 | | |
64 | 75 | | |
65 | | - | |
66 | 76 | | |
67 | 77 | | |
68 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
69 | 84 | | |
| 85 | + | |
| 86 | + | |
70 | 87 | | |
71 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
72 | 92 | | |
73 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
74 | 103 | | |
75 | 104 | | |
76 | 105 | | |
77 | 106 | | |
78 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
79 | 132 | | |
80 | 133 | | |
81 | 134 | | |
0 commit comments
Comments
(0)