Skip to content

Commit

Permalink
Don't use utf8_en/decode() functions, they're deprecated on PHP 8.2 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas authored Jun 18, 2022
1 parent a5ed8d5 commit f88dcf4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/EmailLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected function getType(&$value)
$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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/DomainPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private function checkLabelLength(bool $isEndOfDomain = false) : Result
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;
Expand All @@ -309,4 +309,4 @@ public function domainPart() : string
{
return $this->domainPart;
}
}
}

0 comments on commit f88dcf4

Please sign in to comment.