Don't use utf8_en/decode() functions, they're deprecated on PHP 8.2 (#325)

This commit is contained in:
Nicolas Grekas
2022-06-18 22:57:19 +02:00
committed by GitHub
parent a5ed8d58ed
commit f88dcf4b14
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -237,7 +237,7 @@ class EmailLexer extends AbstractLexer
$encoded = $value;
if (mb_detect_encoding($value, 'auto', true) !== 'UTF-8') {
$encoded = utf8_encode($value);
$encoded = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
}
if ($this->isValid($encoded)) {
+2 -2
View File
@@ -292,7 +292,7 @@ class DomainPart extends PartParser
private function isLabelTooLong(string $label) : bool
{
if (preg_match('/[^\x00-\x7F]/', $label)) {
idn_to_ascii(utf8_decode($label), IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $idnaInfo);
idn_to_ascii($label, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46, $idnaInfo);
return (bool) ($idnaInfo['errors'] & IDNA_ERROR_LABEL_TOO_LONG);
}
return strlen($label) > self::LABEL_MAX_LENGTH;
@@ -309,4 +309,4 @@ class DomainPart extends PartParser
{
return $this->domainPart;
}
}
}