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 a1be3d5

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

File tree

1 file changed

+4
-0
lines changed
Filter options

1 file changed

+4
-0
lines changed

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

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