8000 bug #57364 [Validator] IBAN validator fails if IBAN contains non-brea… · symfony/symfony@4497742 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4497742

Browse files
committed
bug #57364 [Validator] IBAN validator fails if IBAN contains non-breaking space
1 parent e6a26db commit 4497742

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ public function validate($value, Constraint $constraint)
182182

183183
$value = (string) $value;
184184

185-
// Remove spaces and convert to uppercase
186-
$canonicalized = str_replace(' ', '', strtoupper($value));
185+
// Remove spaces and non-breaking spaces and convert to uppercase
186+
$canonicalized = str_replace([' ', '\XC2\XA0'], '', strtoupper($value));
187187

188188
// The IBAN must contain only digits and characters...
189189
if (!ctype_alnum($canonicalized)) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public static function getValidIbans()
7676
['FO97 5432 0388 8999 44'], // Faroe Islands
7777
['FI21 1234 5600 0007 85'], // Finland
7878
['FR14 2004 1010 0505 0001 3M02 606'], // France
79+
['FR14\xc2\xa02004\xc2\xa01010\xc2\xa00505\xc2\xa00001\xc2\xa03M02\xc2\xa0606'], // France with non-breaking spaces
7980
['GE29 NB00 0000 0101 9049 17'], // Georgia
8081
['DE89 3704 0044 0532 0130 00'], // Germany
8182
['GI75 NWBK 0000 0000 7099 453'], // Gibraltar

0 commit comments

Comments
 (0)
0