mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-04 14:38:21 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f88dcf4b14 |
+1
-1
@@ -237,7 +237,7 @@ class EmailLexer extends AbstractLexer
|
|||||||
$encoded = $value;
|
$encoded = $value;
|
||||||
|
|
||||||
if (mb_detect_encoding($value, 'auto', true) !== 'UTF-8') {
|
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)) {
|
if ($this->isValid($encoded)) {
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ class DomainPart extends PartParser
|
|||||||
private function isLabelTooLong(string $label) : bool
|
private function isLabelTooLong(string $label) : bool
|
||||||
{
|
{
|
||||||
if (preg_match('/[^\x00-\x7F]/', $label)) {
|
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 (bool) ($idnaInfo['errors'] & IDNA_ERROR_LABEL_TOO_LONG);
|
||||||
}
|
}
|
||||||
return strlen($label) > self::LABEL_MAX_LENGTH;
|
return strlen($label) > self::LABEL_MAX_LENGTH;
|
||||||
|
|||||||
Reference in New Issue
Block a user