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

Skip to content

Commit a53cc5c

Browse files
committed
19 digits VISA card numbers are valid
1 parent d78a98d commit a53cc5c

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)