[Validator] Fixed IBAN validator with 0750447346 value

This commit is contained in:
Stefano Sala 2013-12-23 19:04:13 +01:00
parent 50c39b946b
commit cf88ba58a6
2 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,13 @@ class IbanValidator extends ConstraintValidator
return;
}
// An IBAN without a country code is not an IBAN.
if (0 === preg_match('/[A-Za-z]/', $value)) {
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
return;
}
$teststring = preg_replace('/\s+/', '', $value);
if (strlen($teststring) < 4) {

View File

@ -182,6 +182,7 @@ class IbanValidatorTest extends \PHPUnit_Framework_TestCase
array('CY170020 128 0000 0012 0052 7600'),
array('foo'),
array('123'),
array('0750447346')
);
}
}