From d60f4f9cabead17c592d2735f4c14d58186b5d2c Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 14 Jun 2022 14:36:29 +0000 Subject: [PATCH] External Libraries: Upgrade PHPMailer to version 6.6.2. Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.2. For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.6.0...v6.6.2. Props ayeshrajans, jrf. Fixes #55976. git-svn-id: https://develop.svn.wordpress.org/trunk@53500 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/PHPMailer/PHPMailer.php | 20 ++++++++++++++------ src/wp-includes/PHPMailer/SMTP.php | 7 +++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/PHPMailer/PHPMailer.php b/src/wp-includes/PHPMailer/PHPMailer.php index 10f3fe8cda..13420c81dd 100644 --- a/src/wp-includes/PHPMailer/PHPMailer.php +++ b/src/wp-includes/PHPMailer/PHPMailer.php @@ -750,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.6.0'; + const VERSION = '6.6.2'; /** * Error severity: message only, continue processing. @@ -1066,8 +1066,8 @@ class PHPMailer * Addresses that have been added already return false, but do not throw exceptions. * * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' - * @param string $address The email address to send, resp. to reply to - * @param string $name + * @param string $address The email address + * @param string $name An optional username associated with the address * * @throws Exception * @@ -1075,9 +1075,11 @@ class PHPMailer */ protected function addOrEnqueueAnAddress($kind, $address, $name) { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - $pos = strrpos($address, '@'); + $pos = false; + if ($address !== null) { + $address = trim($address); + $pos = strrpos($address, '@'); + } if (false === $pos) { //At-sign is missing. $error_message = sprintf( @@ -1094,8 +1096,14 @@ class PHPMailer return false; } + if ($name !== null) { + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + } else { + $name = ''; + } $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)) { diff --git a/src/wp-includes/PHPMailer/SMTP.php b/src/wp-includes/PHPMailer/SMTP.php index 5ecad21dae..64fd078267 100644 --- a/src/wp-includes/PHPMailer/SMTP.php +++ b/src/wp-includes/PHPMailer/SMTP.php @@ -35,7 +35,7 @@ class SMTP * * @var string */ - const VERSION = '6.6.0'; + const VERSION = '6.6.2'; /** * SMTP line break constant. @@ -1037,7 +1037,10 @@ class SMTP return false; } - $this->setError(''); + //Don't clear the error store when using keepalive + if ($command !== 'RSET') { + $this->setError(''); + } return true; }