8000 Fix IBAN validator · symfony/symfony@3eeb306 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3eeb306

Browse files
committed
Fix IBAN validator
1 parent d4a78fe commit 3eeb306

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Symfony/Component/Validator/Constraints/IbanValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function validate($value, Constraint $constraint)
3131
}
3232

3333
// An IBAN without a country code is not an IBAN.
34-
if (0 === preg_match('/[A-Za-z]/', $value)) {
34+
if (0 === preg_match('/[A-Z]/', $value)) {
3535
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
3636

3737
return;
@@ -50,7 +50,7 @@ public function validate($value, Constraint $constraint)
5050
.strval(ord($teststring{1}) - 55)
5151
.substr($teststring, 2, 2);
5252

53-
$teststring = preg_replace_callback('/[A-Za-z]/', function ($letter) {
53+
$teststring = preg_replace_callback('/[A-Z]/', function ($letter) {
5454
return intval(ord(strtolower($letter[0])) - 87);
5555
}, $teststring);
5656

src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ public function getInvalidIbans()
182182
array('foo'),
183183
array('123'),
184184
array('0750447346'),
185+
186+
//Ibans with lower case values are invalid
187+
array('Ae260211000000230064016'),
188+
array('ae260211000000230064016')
185189
);
186190
}
187191
}

0 commit comments

Comments
 (0)
0