Fail to add an address if it uses 8-bit chars in the domain, but we are missing extensions to support IDN.
This commit is contained in:
parent
1ef59a2a99
commit
fc6779f050
|
|
@ -151,7 +151,7 @@ jobs:
|
|||
echo 'COMPOSER_OPTIONS=' >> $GITHUB_OUTPUT
|
||||
else
|
||||
# Minimal.
|
||||
echo 'EXT=none, curl, dom, json, libxml, tokenizer, xml, xmlwriter, ctype, filter, hash' >> $GITHUB_OUTPUT
|
||||
echo 'EXT=none, curl, dom, json, libxml, mbstring, tokenizer, xml, xmlwriter, ctype, filter, hash' >> $GITHUB_OUTPUT
|
||||
echo 'COMPOSER_OPTIONS=--ignore-platform-req=ext-simplexml' >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1122,19 +1122,22 @@ class PHPMailer
|
|||
$params = [$kind, $address, $name];
|
||||
//Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
|
||||
//Domain is assumed to be whatever is after the last @ symbol in the address
|
||||
if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) {
|
||||
if ('Reply-To' !== $kind) {
|
||||
if (!array_key_exists($address, $this->RecipientsQueue)) {
|
||||
$this->RecipientsQueue[$address] = $params;
|
||||
if ($this->has8bitChars(substr($address, ++$pos))) {
|
||||
if (static::idnSupported()) {
|
||||
if ('Reply-To' !== $kind) {
|
||||
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;
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ final class DKIMTest extends SendTestCase
|
|||
public function testDKIMSignOpenSSLNotAvailableException()
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class DKIMWithoutExceptionsTest extends TestCase
|
|||
public function testDKIMSignOpenSSLNotAvailable()
|
||||
{
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ final class FileIsAccessibleTest extends TestCase
|
|||
{
|
||||
if (\DIRECTORY_SEPARATOR === '\\') {
|
||||
// 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/';
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ final class ParseAddressesTest extends TestCase
|
|||
public function testAddressSplittingNativeNoMbstring($addrstr, $expected, $charset = null)
|
||||
{
|
||||
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)) {
|
||||
|
|
@ -136,7 +136,7 @@ final class ParseAddressesTest extends TestCase
|
|||
public function testAddressSplittingImapNoMbstring($addrstr, $expected, $charset = null)
|
||||
{
|
||||
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)) {
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ final class ReplyToGetSetClearTest extends PreSendTestCase
|
|||
public function testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions()
|
||||
{
|
||||
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'));
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ final class SetFromTest extends TestCase
|
|||
public function testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions()
|
||||
{
|
||||
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");
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ final class PopBeforeSmtpTest extends TestCase
|
|||
protected function set_up()
|
||||
{
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue