zendframework/zend-validator

Validating VISA credit cards fails if card number length is not equal to 16.

Closed this issue · 0 comments

According to this Wikipedia Page length of a Visa card number can be 13, 16 and 19.

I recognized this issue when I used fzaninotto/faker in my PhpUnit test script, it failed for the times when the generated number is like 4909117994192. It uses templates for the Visa card number generation listed below:

[
    'Visa' => array(
            "4539########",
            "4539###########",
            "4556########",
            "4556###########",
            "4916########",
            "4916###########",
            "4532########",
            "4532###########",
            "4929########",
            "4929###########",
            "40240071####",
            "40240071#######",
            "4485########",
            "4485###########",
            "4716########",
            "4716###########",
            "4###########",
            "4##############"
    )
];

It is reported that length of most Visa cards' number is 16. If this is why only 16 selected for Visa cards, that's ok. If not I would like to send PR for this issue.