<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[51634] trunk/src/wp-includes/PHPMailer: External Libraries: Upgrade PHPMailer to version 6.5.1.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/51634">51634</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/51634","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-08-18 13:52:16 +0000 (Wed, 18 Aug 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>External Libraries: Upgrade PHPMailer to version 6.5.1.
The latest release includes preliminary PHP 8.1 support, as well as some small bug fixes.
Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.1
For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.5.0...v6.5.1
Follow-up to <a href="https://core.trac.wordpress.org/changeset/50628">[50628]</a>, <a href="https://core.trac.wordpress.org/changeset/50799">[50799]</a>, <a href="https://core.trac.wordpress.org/changeset/51169">[51169]</a>.
Props jrf.
Fixes <a href="https://core.trac.wordpress.org/ticket/53953">#53953</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesPHPMailerExceptionphp">trunk/src/wp-includes/PHPMailer/Exception.php</a></li>
<li><a href="#trunksrcwpincludesPHPMailerPHPMailerphp">trunk/src/wp-includes/PHPMailer/PHPMailer.php</a></li>
<li><a href="#trunksrcwpincludesPHPMailerSMTPphp">trunk/src/wp-includes/PHPMailer/SMTP.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesPHPMailerExceptionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/PHPMailer/Exception.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/PHPMailer/Exception.php 2021-08-18 13:22:02 UTC (rev 51633)
+++ trunk/src/wp-includes/PHPMailer/Exception.php 2021-08-18 13:52:16 UTC (rev 51634)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,6 +35,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function errorMessage()
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesPHPMailerPHPMailerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/PHPMailer/PHPMailer.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/PHPMailer/PHPMailer.php 2021-08-18 13:22:02 UTC (rev 51633)
+++ trunk/src/wp-includes/PHPMailer/PHPMailer.php 2021-08-18 13:52:16 UTC (rev 51634)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -103,7 +103,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public $From = 'root@localhost';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $From = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * The From name of the message.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,7 +110,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public $FromName = 'Root User';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $FromName = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * The envelope sender of the message.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -689,7 +689,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $boundary = [];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The array of available languages.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The array of available text strings for the current language.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -750,7 +750,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const VERSION = '6.5.0';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const VERSION = '6.5.1';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Error severity: message only, continue processing.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -858,7 +858,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> private function mailPassthru($to, $subject, $body, $header, $params)
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> //Check overloading of mail function to avoid double-encoding
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (ini_get('mbstring.func_overload') & 1) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (ini_get('mbstring.func_overload') & 1) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $subject = $this->secureHeader($subject);
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $subject = $this->encodeHeader($this->secureHeader($subject));
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1188,25 +1188,33 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function parseAddresses($addrstr, $useimap = true)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591)
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="cx" style="display: block; padding: 0 10px"> $addresses = [];
</span><span class="cx" style="display: block; padding: 0 10px"> if ($useimap && function_exists('imap_rfc822_parse_adrlist')) {
</span><span class="cx" style="display: block; padding: 0 10px"> //Use this built-in parser if it's available
</span><span class="cx" style="display: block; padding: 0 10px"> $list = imap_rfc822_parse_adrlist($addrstr, '');
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Clear any potential IMAP errors to get rid of notices being thrown at end of script.
+ imap_errors();
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ($list as $address) {
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress(
- $address->mailbox . '@' . $address->host
- )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '.SYNTAX-ERROR.' !== $address->host &&
+ static::validateAddress($address->mailbox . '@' . $address->host)
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> //Decode the name part if it's present and encoded
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="cx" style="display: block; padding: 0 10px"> property_exists($address, 'personal') &&
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- extension_loaded('mbstring') &&
- preg_match('/^=\?.*\?=$/', $address->personal)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
+ defined('MB_CASE_UPPER') &&
+ preg_match('/^=\?.*\?=$/s', $address->personal)
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $origCharset = mb_internal_encoding();
+ mb_internal_encoding($charset);
+ //Undo any RFC2047-encoded spaces-as-underscores
+ $address->personal = str_replace('_', '=20', $address->personal);
+ //Decode the name
</ins><span class="cx" style="display: block; padding: 0 10px"> $address->personal = mb_decode_mimeheader($address->personal);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ mb_internal_encoding($origCharset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $addresses[] = [
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1234,9 +1242,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $email = trim(str_replace('>', '', $email));
</span><span class="cx" style="display: block; padding: 0 10px"> $name = trim($name);
</span><span class="cx" style="display: block; padding: 0 10px"> if (static::validateAddress($email)) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
</ins><span class="cx" style="display: block; padding: 0 10px"> //If this name is encoded, decode it
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (preg_match('/^=\?.*\?=$/', $name)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) {
+ $origCharset = mb_internal_encoding();
+ mb_internal_encoding($charset);
+ //Undo any RFC2047-encoded spaces-as-underscores
+ $name = str_replace('_', '=20', $name);
+ //Decode the name
</ins><span class="cx" style="display: block; padding: 0 10px"> $name = mb_decode_mimeheader($name);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ mb_internal_encoding($origCharset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $addresses[] = [
</span><span class="cx" style="display: block; padding: 0 10px"> //Remove any surrounding quotes and spaces from the name
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1439,11 +1454,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46);
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif (defined('INTL_IDNA_VARIANT_2003')) {
</span><span class="cx" style="display: block; padding: 0 10px"> //Fall back to this old, deprecated/removed encoding
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated
</del><span class="cx" style="display: block; padding: 0 10px"> $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003);
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> //Fall back to a default we don't know about
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
</del><span class="cx" style="display: block; padding: 0 10px"> $punycode = idn_to_ascii($domain, $errorcode);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if (false !== $punycode) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1510,12 +1523,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> && ini_get('mail.add_x_header') === '1'
</span><span class="cx" style="display: block; padding: 0 10px"> && stripos(PHP_OS, 'WIN') === 0
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- trigger_error(
- 'Your version of PHP is affected by a bug that may result in corrupted messages.' .
- ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
- ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
- E_USER_WARNING
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ trigger_error($this->lang('buggy_php'), E_USER_WARNING);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1726,7 +1734,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> fwrite($mail, $header);
</span><span class="cx" style="display: block; padding: 0 10px"> fwrite($mail, $body);
</span><span class="cx" style="display: block; padding: 0 10px"> $result = pclose($mail);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $addrinfo = static::parseAddresses($toAddr);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $addrinfo = static::parseAddresses($toAddr, true, $this->charSet);
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->doCallback(
</span><span class="cx" style="display: block; padding: 0 10px"> ($result === 0),
</span><span class="cx" style="display: block; padding: 0 10px"> [[$addrinfo['address'], $addrinfo['name']]],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1886,7 +1894,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ($this->SingleTo && count($toArr) > 1) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ($toArr as $toAddr) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $addrinfo = static::parseAddresses($toAddr);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $addrinfo = static::parseAddresses($toAddr, true, $this->charSet);
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->doCallback(
</span><span class="cx" style="display: block; padding: 0 10px"> $result,
</span><span class="cx" style="display: block; padding: 0 10px"> [[$addrinfo['address'], $addrinfo['name']]],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2183,14 +2191,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Set the language for error messages.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Returns false if it cannot load the language file.
</del><span class="cx" style="display: block; padding: 0 10px"> * The default language is English.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Optionally, the language code can be enhanced with a 4-character
+ * script annotation and/or a 2-character country annotation.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $lang_path Path to the language file directory, with trailing separator (slash).D
</span><span class="cx" style="display: block; padding: 0 10px"> * Do not set this from user input!
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool Returns true if the requested language was loaded, false otherwise.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setLanguage($langcode = 'en', $lang_path = '')
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2213,16 +2222,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> //Define full set of translatable strings in English
</span><span class="cx" style="display: block; padding: 0 10px"> $PHPMAILER_LANG = [
</span><span class="cx" style="display: block; padding: 0 10px"> 'authenticate' => 'SMTP Error: Could not authenticate.',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'buggy_php' => 'Your version of PHP is affected by a bug that may result in corrupted messages.' .
+ ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
+ ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
</span><span class="cx" style="display: block; padding: 0 10px"> 'data_not_accepted' => 'SMTP Error: data not accepted.',
</span><span class="cx" style="display: block; padding: 0 10px"> 'empty_message' => 'Message body empty',
</span><span class="cx" style="display: block; padding: 0 10px"> 'encoding' => 'Unknown encoding: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'execute' => 'Could not execute: ',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'extension_missing' => 'Extension missing: ',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'file_access' => 'Could not access file: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'file_open' => 'File Error: Could not open file: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'from_failed' => 'The following From address failed: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'instantiate' => 'Could not instantiate mail function.',
</span><span class="cx" style="display: block; padding: 0 10px"> 'invalid_address' => 'Invalid address: ',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'invalid_header' => 'Invalid header name or value',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'invalid_hostentry' => 'Invalid hostentry: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'invalid_host' => 'Invalid host: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'mailer_not_supported' => ' mailer is not supported.',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2229,28 +2243,56 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'provide_address' => 'You must provide at least one recipient email address.',
</span><span class="cx" style="display: block; padding: 0 10px"> 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'signing' => 'Signing Error: ',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'smtp_code' => 'SMTP code: ',
+ 'smtp_code_ex' => 'Additional SMTP info: ',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'smtp_connect_failed' => 'SMTP connect() failed.',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'smtp_detail' => 'Detail: ',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'smtp_error' => 'SMTP server error: ',
</span><span class="cx" style="display: block; padding: 0 10px"> 'variable_set' => 'Cannot set or reset variable: ',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'extension_missing' => 'Extension missing: ',
</del><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px"> if (empty($lang_path)) {
</span><span class="cx" style="display: block; padding: 0 10px"> //Calculate an absolute path so it can work if CWD is not here
</span><span class="cx" style="display: block; padding: 0 10px"> $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> //Validate $langcode
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $foundlang = true;
+ $langcode = strtolower($langcode);
+ if (
+ !preg_match('/^(?P<lang>[a-z]{2})(?P<script>_[a-z]{4})?(?P<country>_[a-z]{2})?$/', $langcode, $matches)
+ && $langcode !== 'en'
+ ) {
+ $foundlang = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> $langcode = 'en';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $foundlang = true;
- $lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> //There is no English translation file
</span><span class="cx" style="display: block; padding: 0 10px"> if ('en' !== $langcode) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- //Make sure language file path is readable
- if (!static::fileIsAccessible($lang_file)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $langcodes = [];
+ if (!empty($matches['script']) && !empty($matches['country'])) {
+ $langcodes[] = $matches['lang'] . $matches['script'] . $matches['country'];
+ }
+ if (!empty($matches['country'])) {
+ $langcodes[] = $matches['lang'] . $matches['country'];
+ }
+ if (!empty($matches['script'])) {
+ $langcodes[] = $matches['lang'] . $matches['script'];
+ }
+ $langcodes[] = $matches['lang'];
+
+ //Try and find a readable language file for the requested language.
+ $foundFile = false;
+ foreach ($langcodes as $code) {
+ $lang_file = $lang_path . 'phpmailer.lang-' . $code . '.php';
+ if (static::fileIsAccessible($lang_file)) {
+ $foundFile = true;
+ break;
+ }
+ }
+
+ if ($foundFile === false) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $foundlang = false;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- //$foundlang = include $lang_file;
</del><span class="cx" style="display: block; padding: 0 10px"> $lines = file($lang_file);
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ($lines as $line) {
</span><span class="cx" style="display: block; padding: 0 10px"> //Translation file lines look like this:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2285,6 +2327,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getTranslations()
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (empty($this->language)) {
+ $this->setLanguage(); // Set the default language.
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $this->language;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2553,7 +2599,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
</span><span class="cx" style="display: block; padding: 0 10px"> //https://tools.ietf.org/html/rfc5322#section-3.6.4
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ('' !== $this->MessageID && preg_match('/^<.*@.*>$/', $this->MessageID)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (
+ '' !== $this->MessageID &&
+ preg_match(
+ '/^<((([a-z\d!#$%&\'*+\/=?^_`{|}~-]+(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)' .
+ '|("(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])' .
+ '|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*"))@(([a-z\d!#$%&\'*+\/=?^_`{|}~-]+' .
+ '(\.[a-z\d!#$%&\'*+\/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]' .
+ '|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\])))>$/Di',
+ $this->MessageID
+ )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->lastMessageID = $this->MessageID;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3937,13 +3993,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (!empty($lasterror['error'])) {
</span><span class="cx" style="display: block; padding: 0 10px"> $msg .= $this->lang('smtp_error') . $lasterror['error'];
</span><span class="cx" style="display: block; padding: 0 10px"> if (!empty($lasterror['detail'])) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $msg .= ' Detail: ' . $lasterror['detail'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $msg .= ' ' . $this->lang('smtp_detail') . $lasterror['detail'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if (!empty($lasterror['smtp_code'])) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $msg .= ' SMTP code: ' . $lasterror['smtp_code'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $msg .= ' ' . $this->lang('smtp_code') . $lasterror['smtp_code'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if (!empty($lasterror['smtp_code_ex'])) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $msg .= ' ' . $this->lang('smtp_code_ex') . $lasterror['smtp_code_ex'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4004,7 +4060,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> empty($host)
</span><span class="cx" style="display: block; padding: 0 10px"> || !is_string($host)
</span><span class="cx" style="display: block; padding: 0 10px"> || strlen($host) > 256
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- || !preg_match('/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+])$/', $host)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ || !preg_match('/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+\])$/', $host)
</ins><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4081,11 +4137,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> list($name, $value) = explode(':', $name, 2);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $name = trim($name);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $value = trim($value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $value = (null === $value) ? '' : trim($value);
</ins><span class="cx" style="display: block; padding: 0 10px"> //Ensure name is not empty, and that neither name nor value contain line breaks
</span><span class="cx" style="display: block; padding: 0 10px"> if (empty($name) || strpbrk($name . $value, "\r\n") !== false) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ($this->exceptions) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- throw new Exception('Invalid header name or value');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ throw new Exception($this->lang('invalid_header'));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4239,7 +4295,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $html The HTML text to convert
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool|callable $advanced Any boolean value to use the internal converter,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * or provide your own callable for custom conversion
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * or provide your own callable for custom conversion.
+ * *Never* pass user-supplied data into this parameter
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="trunksrcwpincludesPHPMailerSMTPphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/PHPMailer/SMTP.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/PHPMailer/SMTP.php 2021-08-18 13:22:02 UTC (rev 51633)
+++ trunk/src/wp-includes/PHPMailer/SMTP.php 2021-08-18 13:52:16 UTC (rev 51634)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,7 +35,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const VERSION = '6.5.0';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const VERSION = '6.5.1';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * SMTP line break constant.
</span></span></pre>
</div>
</div>
</body>
</html>