mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 02:30:06 +02:00
Fix Pesel validator when first char is zero
This commit is contained in:
parent
b8ecd59f48
commit
73a9ff40eb
|
@ -15,9 +15,7 @@ class Pesel extends AbstractRule
|
|||
{
|
||||
public function validate($input)
|
||||
{
|
||||
if (!is_numeric($input)
|
||||
|| !filter_var($input, FILTER_VALIDATE_INT)
|
||||
|| strlen($input) != 11) {
|
||||
if (!preg_match('/^\d{11}$/', $input)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ class PeselTest extends RuleTestCase
|
|||
[$rule, '39012110375'],
|
||||
[$rule, '50083014540'],
|
||||
[$rule, '69090515504'],
|
||||
[$rule, '21120209256']
|
||||
[$rule, '21120209256'],
|
||||
[$rule, '01320613891']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -45,6 +46,7 @@ class PeselTest extends RuleTestCase
|
|||
[$rule, '690905155.4'],
|
||||
[$rule, '21120209251'],
|
||||
[$rule, '21120209250'],
|
||||
[$rule, '01320613890']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue