8000 [Validator] Convert encoding to UTF-8 when needed in NotPwnedValidator · symfony/symfony@a1be3d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1be3d5

Browse files
committed
[Validator] Convert encoding to UTF-8 when needed in NotPwnedValidator
1 parent 5fe3701 commit a1be3d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public function validate($value, Constraint $constraint)
6161
return;
6262
}
6363

64+
if ('UTF-8' !== $encoding = mb_detect_encoding($value)) {
65+
$value = mb_convert_encoding($value, 'UTF-8', $encoding);
66+
}
67+
6468
$hash = strtoupper(sha1($value));
6569
$hashPrefix = substr($hash, 0, 5);
6670
$url = sprintf(self::RANGE_API, $hashPrefix);

0 commit comments

Comments
 (0)
0