Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Sep 11, 2024
1 parent ea73ee0 commit 9259ff7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ jobs:
- name: Run tests, no code coverage
if: ${{ matrix.coverage == false || github.repository != 'PHPMailer/PHPMailer' }}
run: ./vendor/bin/phpunit --no-coverage
run: ./vendor/bin/phpunit --no-coverage --testdox --filter PunyencodeAddressTest

- name: Run tests with code coverage
if: ${{ matrix.coverage == true && github.repository == 'PHPMailer/PHPMailer' }}
run: vendor/bin/phpunit
run: vendor/bin/phpunit --testdox --filter PunyencodeAddressTest

- name: Send coverage report to Codecov
if: ${{ success() && matrix.coverage == true && github.repository == 'PHPMailer/PHPMailer' }}
Expand Down
7 changes: 7 additions & 0 deletions src/PHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1472,14 +1472,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,
Expand All @@ -1488,18 +1491,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;
}

Expand Down

0 comments on commit 9259ff7

Please sign in to comment.