Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3eeb306

Browse filesBrowse files
committed
Fix IBAN validator
1 parent d4a78fe commit 3eeb306
Copy full SHA for 3eeb306

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/IbanValidator.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php
+4Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.