External Libraries: Upgrade PHPMailer to version 6.7.

This is a bug fix release which also contains some PHP 8.1 related improvements.

References:
* [https://github.com/PHPMailer/PHPMailer/releases/tag/v6.7 PHPMailer 6.7 release notes]
* [https://github.com/PHPMailer/PHPMailer/compare/v6.6.5...v6.7 Full list of changes in PHPMailer 6.7]

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500], [53535], [53917], [54427].

Props jrf, Synchro.
Fixes #57281.
Built from https://develop.svn.wordpress.org/trunk@54937


git-svn-id: http://core.svn.wordpress.org/trunk@54489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-12-06 12:19:15 +00:00
parent 867203db05
commit e6f755adec
3 changed files with 53 additions and 15 deletions

View File

@ -750,7 +750,7 @@ class PHPMailer
*
* @var string
*/
const VERSION = '6.6.5';
const VERSION = '6.7';
/**
* Error severity: message only, continue processing.
@ -858,7 +858,7 @@ class PHPMailer
private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if (ini_get('mbstring.func_overload') & 1) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
if ((int)ini_get('mbstring.func_overload') & 1) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
$subject = $this->secureHeader($subject);
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
@ -1124,6 +1124,22 @@ class PHPMailer
return call_user_func_array([$this, 'addAnAddress'], $params);
}
/**
* Set the boundaries to use for delimiting MIME parts.
* If you override this, ensure you set all 3 boundaries to unique values.
* The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies,
* as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7
*
* @return void
*/
public function setBoundaries()
{
$this->uniqueid = $this->generateId();
$this->boundary[1] = 'b1=_' . $this->uniqueid;
$this->boundary[2] = 'b2=_' . $this->uniqueid;
$this->boundary[3] = 'b3=_' . $this->uniqueid;
}
/**
* Add an address to one of the recipient arrays or to the ReplyTo array.
* Addresses that have been added already return false, but do not throw exceptions.
@ -1673,11 +1689,11 @@ class PHPMailer
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
}
} catch (Exception $exc) {
$this->setError($exc->getMessage());
$this->edebug($exc->getMessage());
if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) {
$this->smtp->reset();
}
$this->setError($exc->getMessage());
$this->edebug($exc->getMessage());
if ($this->exceptions) {
throw $exc;
}
@ -2796,10 +2812,7 @@ class PHPMailer
{
$body = '';
//Create unique IDs and preset boundaries
$this->uniqueid = $this->generateId();
$this->boundary[1] = 'b1_' . $this->uniqueid;
$this->boundary[2] = 'b2_' . $this->uniqueid;
$this->boundary[3] = 'b3_' . $this->uniqueid;
$this->setBoundaries();
if ($this->sign_key_file) {
$body .= $this->getMailMIME() . static::$LE;
@ -2835,7 +2848,7 @@ class PHPMailer
$altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
}
//Use this as a preamble in all multipart message types
$mimepre = 'This is a multi-part message in MIME format.' . static::$LE . static::$LE;
$mimepre = '';
switch ($this->message_type) {
case 'inline':
$body .= $mimepre;
@ -3071,6 +3084,18 @@ class PHPMailer
return $body;
}
/**
* Get the boundaries that this message will use
* @return array
*/
public function getBoundaries()
{
if (empty($this->boundary)) {
$this->setBoundaries();
}
return $this->boundary;
}
/**
* Return the start of a message boundary.
*
@ -4188,6 +4213,7 @@ class PHPMailer
* @param string $name Custom header name
* @param string|null $value Header value
*
* @return bool True if a header was set successfully
* @throws Exception
*/
public function addCustomHeader($name, $value = null)
@ -4637,15 +4663,27 @@ class PHPMailer
}
/**
* Remove trailing breaks from a string.
* Remove trailing whitespace from a string.
*
* @param string $text
*
* @return string The text to remove whitespace from
*/
public static function stripTrailingWSP($text)
{
return rtrim($text, " \r\n\t");
}
/**
* Strip trailing line breaks from a string.
*
* @param string $text
*
* @return string The text to remove breaks from
*/
public static function stripTrailingWSP($text)
public static function stripTrailingBreaks($text)
{
return rtrim($text, " \r\n\t");
return rtrim($text, "\r\n");
}
/**
@ -4811,7 +4849,7 @@ class PHPMailer
$body = static::normalizeBreaks($body, self::CRLF);
//Reduce multiple trailing line breaks to a single one
return static::stripTrailingWSP($body) . self::CRLF;
return static::stripTrailingBreaks($body) . self::CRLF;
}
/**

View File

@ -35,7 +35,7 @@ class SMTP
*
* @var string
*/
const VERSION = '6.6.5';
const VERSION = '6.7';
/**
* SMTP line break constant.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-54936';
$wp_version = '6.2-alpha-54937';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.