Fix #2563: Provide the right flags to IDN methods for email addresses conversion
This commit is contained in:
parent
e84b657160
commit
3c81f485df
|
|
@ -1451,7 +1451,11 @@ class PHPMailer
|
|||
$errorcode = 0;
|
||||
if (defined('INTL_IDNA_VARIANT_UTS46')) {
|
||||
//Use the current punycode standard (appeared in PHP 7.2)
|
||||
$punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46);
|
||||
$punycode = idn_to_ascii(
|
||||
$domain,
|
||||
\IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII,
|
||||
\INTL_IDNA_VARIANT_UTS46
|
||||
);
|
||||
} elseif (defined('INTL_IDNA_VARIANT_2003')) {
|
||||
//Fall back to this old, deprecated/removed encoding
|
||||
$punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ final class PunyencodeAddressTest extends TestCase
|
|||
'charset' => PHPMailer::CHARSET_UTF8,
|
||||
'expected' => 'françois@xn--franois-xxa.ch',
|
||||
],
|
||||
'IDN conversion flags' => [
|
||||
'input' => 'test@fußball.test',
|
||||
'charset' => PHPMailer::CHARSET_UTF8,
|
||||
'expected' => 'test@xn--fuball-cta.test',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue