Skip to content

Commit a24ba1c

Browse files
javiereguiluzfabpot
authored andcommitted
Fixed the regexp for the validator of Maestro-based credit/debit cards
1 parent fac8d90 commit a24ba1c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Constraints/CardSchemeValidator.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*
2020
* @see http://en.wikipedia.org/wiki/Bank_card_number
2121
* @see http://www.regular-expressions.info/creditcard.html
22+
* @see http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf
2223
*
2324
* @author Tim Nagel <t.nagel@infinite.net.au>
2425
*/
@@ -61,10 +62,12 @@ class CardSchemeValidator extends ConstraintValidator
6162
'LASER' => array(
6263
'/^(6304|670[69]|6771)[0-9]{12,15}$/',
6364
),
64-
// Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604
65-
// They have between 12 and 19 digits.
65+
// Maestro international cards begin with 675900..675999 and have between 12 and 19 digits.
66+
// Maestro UK cards begin with either 500000..509999 or 560000..699999 and have between 12 and 19 digits.
6667
'MAESTRO' => array(
67-
'/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/',
68+
'/^(6759[0-9]{2})[0-9]{6,13}$/',
69+
'/^(50[0-9]{4})[0-9]{6,13}$/',
70+
'/^([56-69][0-9]{4})[0-9]{6,13}$/',
6871
),
6972
// All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
7073
'MASTERCARD' => array(

0 commit comments

Comments
 (0)