8000 [Validator] Fix space escape. · symfony/symfony@bf70d77 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf70d77

Browse files
committed
[Validator] Fix space escape.
1 parent c91e80e commit bf70d77

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function validate($value, Constraint $constraint)
183183
$value = (string) $value;
184184

185185
// Remove spaces (regular, non-breaking, and narrow non-breaking) and convert to uppercase
186-
$canonicalized = str_replace([' ', '\XC2\XA0', '\XE2\X80\XAF'], '', strtoupper($value));
186+
$canonicalized = str_replace([' ', "\xc2\xa0", "\xe2\x80\xaf"], '', 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ 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
80-
['FR14\xe2\x80\xaf2004\xe2\x80\xaf1010\xe2\x80\xaf0505\xe2\x80\xaf0001\xe2\x80\xaf3M02\xe2\x80\xaf606'], // France with narrow non-breaking spaces
79+
["FR14\xc2\xa02004\xc2\xa01010\xc2\xa00505\xc2\xa00001\xc2\xa03M02\xc2\xa0606"], // France with non-breaking spaces
80+
["FR14\xe2\x80\xaf2004\xe2\x80\xaf1010\xe2\x80\xaf0505\xe2\x80\xaf0001\xe2\x80\xaf3M02\xe2\x80\xaf606"], // France with narrow non-breaking spaces
8181
['GE29 NB00 0000 0101 9049 17'], // Georgia
8282
['DE89 3704 0044 0532 0130 00'], // Germany
8383
['GI75 NWBK 0000 0000 7099 453'], // Gibraltar

0 commit comments

Comments
 (0)
0