bug #9850 [Validator] Fixed IBAN validator with 0750447346 value (stewe)

This PR was merged into the 2.3 branch.

Discussion
----------

[Validator] Fixed IBAN validator with 0750447346 value

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

cf88ba5 [Validator] Fixed IBAN validator with 0750447346 value
This commit is contained in:
Fabien Potencier 2013-12-28 14:42:37 +01:00
commit c33341df09
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

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