bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
This PR was merged into the 2.3 branch.
Discussion
----------
[Validator] fix validation for Maestro UK card numbers
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #15085
| License | MIT
| Doc PR |
The issue with the fix in #15086 was, that the `[56-69]` part of the regular expression did not cover the numbers from 56 to 69 but only matched one number if it was 5, 6 or 9 which means that the regular expression itself was not only invalid, but also covered only a total maximum length of 18 digits.
Commits
-------
f24532a
fix validation for Maestro UK card numbers
This commit is contained in:
commit
77da994658
@ -67,7 +67,8 @@ class CardSchemeValidator extends ConstraintValidator
|
|||||||
'MAESTRO' => array(
|
'MAESTRO' => array(
|
||||||
'/^(6759[0-9]{2})[0-9]{6,13}$/',
|
'/^(6759[0-9]{2})[0-9]{6,13}$/',
|
||||||
'/^(50[0-9]{4})[0-9]{6,13}$/',
|
'/^(50[0-9]{4})[0-9]{6,13}$/',
|
||||||
'/^([56-69][0-9]{4})[0-9]{6,13}$/',
|
'/^5[6-9][0-9]{10,17}$/',
|
||||||
|
'/^6[0-9]{11,18}$/',
|
||||||
),
|
),
|
||||||
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
|
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
|
||||||
'MASTERCARD' => array(
|
'MASTERCARD' => array(
|
||||||
|
@ -90,8 +90,10 @@ class CardSchemeValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
array('LASER', '6771656738314582216'),
|
array('LASER', '6771656738314582216'),
|
||||||
array('MAESTRO', '6759744069209'),
|
array('MAESTRO', '6759744069209'),
|
||||||
array('MAESTRO', '5020507657408074712'),
|
array('MAESTRO', '5020507657408074712'),
|
||||||
|
array('MAESTRO', '5612559223580173965'),
|
||||||
array('MAESTRO', '6759744069209'),
|
array('MAESTRO', '6759744069209'),
|
||||||
array('MAESTRO', '6759744069209'),
|
array('MAESTRO', '6759744069209'),
|
||||||
|
array('MAESTRO', '6594371785970435599'),
|
||||||
array('MASTERCARD', '5555555555554444'),
|
array('MASTERCARD', '5555555555554444'),
|
||||||
array('MASTERCARD', '5105105105105100'),
|
array('MASTERCARD', '5105105105105100'),
|
||||||
array('VISA', '4111111111111111'),
|
array('VISA', '4111111111111111'),
|
||||||
|
Reference in New Issue
Block a user