Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae8b5a7

Browse files
committed
bug #25771 [Validator] 19 digits VISA card numbers are valid (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [Validator] 19 digits VISA card numbers are valid | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | some sources: * https://en.wikipedia.org/wiki/Payment_card_number * https://blog.vindicia.com/19-digit-visas-and-2-digit-mastercards/ * https://www.nccgroup.trust/de/uber-uns/newsroom-and-events/blogs/2016/november/prepare-for-19-digit-credit-cards/ * http://support.worldpay.com/support/kb/bg/testandgolive/tgl5103.html Commits ------- a53cc5c 19 digits VISA card numbers are valid
2 parents d78a98d + a53cc5c commit ae8b5a7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ class CardSchemeValidator extends ConstraintValidator
7979
'/^5[1-5][0-9]{14}$/',
8080
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
8181
),
82-
// All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
82+
// All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits.
8383
'VISA' => array(
84-
'/^4([0-9]{12}|[0-9]{15})$/',
84+
'/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/',
8585
),
8686
);
8787

src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public function getValidNumbers()
111111
array('VISA', '4111111111111111'),
112112
array('VISA', '4012888888881881'),
113113
array('VISA', '4222222222222'),
114+
array('VISA', '4917610000000000003'),
114115
array(array('AMEX', 'VISA'), '4111111111111111'),
115116
array(array('AMEX', 'VISA'), '378282246310005'),
116117
array(array('JCB', 'MASTERCARD'), '5105105105105100'),

0 commit comments

Comments
 (0)