Merge branch 'SMTPUTF8-test' into SMTPUTF8

This commit is contained in:
Marcus Bointon 2025-04-10 16:11:46 +02:00
commit c5dae41b32
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
8 changed files with 20 additions and 17 deletions

View File

@ -1122,19 +1122,22 @@ class PHPMailer
$params = [$kind, $address, $name]; $params = [$kind, $address, $name];
//Enqueue addresses with IDN until we know the PHPMailer::$CharSet. //Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
//Domain is assumed to be whatever is after the last @ symbol in the address //Domain is assumed to be whatever is after the last @ symbol in the address
if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) { if ($this->has8bitChars(substr($address, ++$pos))) {
if ('Reply-To' !== $kind) { if (static::idnSupported()) {
if (!array_key_exists($address, $this->RecipientsQueue)) { if ('Reply-To' !== $kind) {
$this->RecipientsQueue[$address] = $params; if (!array_key_exists($address, $this->RecipientsQueue)) {
$this->RecipientsQueue[$address] = $params;
return true;
}
} elseif (!array_key_exists($address, $this->ReplyToQueue)) {
$this->ReplyToQueue[$address] = $params;
return true; return true;
} }
} elseif (!array_key_exists($address, $this->ReplyToQueue)) {
$this->ReplyToQueue[$address] = $params;
return true;
} }
//We have an 8-bit domain, but we are missing the necessary extensions to support it
//Or we are already sending to this address
return false; return false;
} }

View File

@ -248,7 +248,7 @@ final class DKIMTest extends SendTestCase
public function testDKIMSignOpenSSLNotAvailableException() public function testDKIMSignOpenSSLNotAvailableException()
{ {
if (extension_loaded('openssl')) { if (extension_loaded('openssl')) {
$this->markTestSkipped('Test requires OpenSSL *not* to be available'); self::markTestSkipped('Test requires OpenSSL *not* to be available');
} }
$this->expectException(Exception::class); $this->expectException(Exception::class);

View File

@ -38,7 +38,7 @@ final class DKIMWithoutExceptionsTest extends TestCase
public function testDKIMSignOpenSSLNotAvailable() public function testDKIMSignOpenSSLNotAvailable()
{ {
if (extension_loaded('openssl')) { if (extension_loaded('openssl')) {
$this->markTestSkipped('Test requires OpenSSL *not* to be available'); self::markTestSkipped('Test requires OpenSSL *not* to be available');
} }
$signature = $this->Mail->DKIM_Sign('foo'); $signature = $this->Mail->DKIM_Sign('foo');

View File

@ -83,7 +83,7 @@ final class FileIsAccessibleTest extends TestCase
{ {
if (\DIRECTORY_SEPARATOR === '\\') { if (\DIRECTORY_SEPARATOR === '\\') {
// Windows does not respect chmod permissions. // Windows does not respect chmod permissions.
$this->markTestSkipped('This test requires a non-Windows OS.'); self::markTestSkipped('This test requires a non-Windows OS.');
} }
$path = dirname(__DIR__) . '/Fixtures/FileIsAccessibleTest/'; $path = dirname(__DIR__) . '/Fixtures/FileIsAccessibleTest/';

View File

@ -102,7 +102,7 @@ final class ParseAddressesTest extends TestCase
public function testAddressSplittingNativeNoMbstring($addrstr, $expected, $charset = null) public function testAddressSplittingNativeNoMbstring($addrstr, $expected, $charset = null)
{ {
if (extension_loaded('mbstring')) { if (extension_loaded('mbstring')) {
$this->markTestSkipped('Test requires MbString *not* to be available'); self::markTestSkipped('Test requires MbString *not* to be available');
} }
if (isset($charset)) { if (isset($charset)) {
@ -136,7 +136,7 @@ final class ParseAddressesTest extends TestCase
public function testAddressSplittingImapNoMbstring($addrstr, $expected, $charset = null) public function testAddressSplittingImapNoMbstring($addrstr, $expected, $charset = null)
{ {
if (extension_loaded('mbstring')) { if (extension_loaded('mbstring')) {
$this->markTestSkipped('Test requires MbString *not* to be available'); self::markTestSkipped('Test requires MbString *not* to be available');
} }
if (isset($charset)) { if (isset($charset)) {

View File

@ -409,7 +409,7 @@ final class ReplyToGetSetClearTest extends PreSendTestCase
public function testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions() public function testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions()
{ {
if (PHPMailer::idnSupported()) { if (PHPMailer::idnSupported()) {
$this->markTestSkipped('Test requires MbString and/or Intl *not* to be available'); self::markTestSkipped('Test requires MbString and/or Intl *not* to be available');
} }
self::assertFalse($this->Mail->addReplyTo('test@françois.ch')); self::assertFalse($this->Mail->addReplyTo('test@françois.ch'));

View File

@ -194,7 +194,7 @@ final class SetFromTest extends TestCase
public function testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions() public function testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions()
{ {
if (extension_loaded('mbstring') && function_exists('idn_to_ascii')) { if (extension_loaded('mbstring') && function_exists('idn_to_ascii')) {
$this->markTestSkipped('Test requires MbString and/or Intl *not* to be available'); self::markTestSkipped('Test requires MbString and/or Intl *not* to be available');
} }
$this->testSetFromFail("8bit@ex\x80mple.com"); $this->testSetFromFail("8bit@ex\x80mple.com");

View File

@ -52,7 +52,7 @@ final class PopBeforeSmtpTest extends TestCase
protected function set_up() protected function set_up()
{ {
if (DIRECTORY_SEPARATOR === '\\') { if (DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('This test needs a non-Windows OS to run'); self::markTestSkipped('This test needs a non-Windows OS to run');
} }
// Chdir to test directory as runfakepopserver.sh runs fakepopserver.sh // Chdir to test directory as runfakepopserver.sh runs fakepopserver.sh