diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 1ca6d399e..314288487 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -1465,6 +1465,8 @@ public static function idnSupported() */ public function punyencodeAddress($address) { +echo '==================================', PHP_EOL; +echo 'Received input: ', $address, PHP_EOL; //Verify we have required functions, CharSet, and at-sign. $pos = strrpos($address, '@'); if ( @@ -1472,14 +1474,17 @@ public function punyencodeAddress($address) false !== $pos && static::idnSupported() ) { +echo __LINE__, ' - in if condition', PHP_EOL; $domain = substr($address, ++$pos); //Verify CharSet string is a valid one, and domain properly encoded in this CharSet. if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) { +echo __LINE__, ' - in second if condition', PHP_EOL; //Convert the domain from whatever charset it's in to UTF-8 $domain = mb_convert_encoding($domain, self::CHARSET_UTF8, $this->CharSet); //Ignore IDE complaints about this line - method signature changed in PHP 5.4 $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { +echo __LINE__, ' - in INTL_IDNA_VARIANT_UTS46 condition', PHP_EOL; //Use the current punycode standard (appeared in PHP 7.2) $punycode = idn_to_ascii( $domain, @@ -1488,18 +1493,22 @@ public function punyencodeAddress($address) \INTL_IDNA_VARIANT_UTS46 ); } elseif (defined('INTL_IDNA_VARIANT_2003')) { +echo __LINE__, ' - in INTL_IDNA_VARIANT_2003 condition', PHP_EOL; //Fall back to this old, deprecated/removed encoding $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003); } else { +echo __LINE__, ' - in fallback condition', PHP_EOL; //Fall back to a default we don't know about $punycode = idn_to_ascii($domain, $errorcode); } if (false !== $punycode) { +echo __LINE__, ' - returning based on punycode not false', PHP_EOL; return substr($address, 0, $pos) . $punycode; } } } +echo __LINE__, ' - fall back return', PHP_EOL; return $address; }