From 1cca88b19be17a6102a86f16bb56349157bf1845 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 26 Nov 2021 00:43:01 +0000 Subject: [PATCH] External Libraries: Upgrade PHPMailer to version 6.5.3. The latest release includes official PHP 8.1 support, as well as some small bug fixes, including one for PHP 5.6 cross-version support. Release notes: * https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.2 * https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.3 For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.5.1...v6.5.3 Follow-up to [50628], [50799], [51169], [51634], [51635]. Props jrf, Synchro. Fixes #54514. Built from https://develop.svn.wordpress.org/trunk@52252 git-svn-id: http://core.svn.wordpress.org/trunk@51844 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/PHPMailer/PHPMailer.php | 21 ++++++++++++++++----- wp-includes/PHPMailer/SMTP.php | 11 +++++------ wp-includes/version.php | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/wp-includes/PHPMailer/PHPMailer.php b/wp-includes/PHPMailer/PHPMailer.php index 5228ef0159..7457f88488 100644 --- a/wp-includes/PHPMailer/PHPMailer.php +++ b/wp-includes/PHPMailer/PHPMailer.php @@ -750,7 +750,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.5.1'; + const VERSION = '6.5.3'; /** * Error severity: message only, continue processing. @@ -1451,7 +1451,12 @@ class PHPMailer $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { //Use the current punycode standard (appeared in PHP 7.2) - $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46); + $punycode = idn_to_ascii( + $domain, + \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | + \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, + \INTL_IDNA_VARIANT_UTS46 + ); } elseif (defined('INTL_IDNA_VARIANT_2003')) { //Fall back to this old, deprecated/removed encoding // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated @@ -1699,7 +1704,10 @@ class PHPMailer //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html //Example problem: https://www.drupal.org/node/1057954 - if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { + + //PHP 5.6 workaround + $sendmail_from_value = ini_get('sendmail_from'); + if (empty($this->Sender) && !empty($sendmail_from_value)) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -1881,7 +1889,10 @@ class PHPMailer //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html //Example problem: https://www.drupal.org/node/1057954 //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. - if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { + + //PHP 5.6 workaround + $sendmail_from_value = ini_get('sendmail_from'); + if (empty($this->Sender) && !empty($sendmail_from_value)) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -2198,7 +2209,7 @@ class PHPMailer * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") * Optionally, the language code can be enhanced with a 4-character * script annotation and/or a 2-character country annotation. - * @param string $lang_path Path to the language file directory, with trailing separator (slash).D + * @param string $lang_path Path to the language file directory, with trailing separator (slash) * Do not set this from user input! * * @return bool Returns true if the requested language was loaded, false otherwise. diff --git a/wp-includes/PHPMailer/SMTP.php b/wp-includes/PHPMailer/SMTP.php index 0cea1e8640..676dba2923 100644 --- a/wp-includes/PHPMailer/SMTP.php +++ b/wp-includes/PHPMailer/SMTP.php @@ -35,7 +35,7 @@ class SMTP * * @var string */ - const VERSION = '6.5.1'; + const VERSION = '6.5.3'; /** * SMTP line break constant. @@ -392,7 +392,6 @@ class SMTP STREAM_CLIENT_CONNECT, $socket_context ); - restore_error_handler(); } else { //Fall back to fsockopen which should work in more places, but is missing some features $this->edebug( @@ -407,8 +406,8 @@ class SMTP $errstr, $timeout ); - restore_error_handler(); } + restore_error_handler(); //Verify we connected properly if (!is_resource($connection)) { @@ -696,7 +695,7 @@ class SMTP /** * Send an SMTP DATA command. * Issues a data command and sends the msg_data to the server, - * finializing the mail transaction. $msg_data is the message + * finalizing the mail transaction. $msg_data is the message * that is to be send with the headers. Each header needs to be * on a single line followed by a with the message headers * and the message body being separated by an additional . @@ -1170,7 +1169,7 @@ class SMTP if (!$this->server_caps) { $this->setError('No HELO/EHLO was sent'); - return; + return null; } if (!array_key_exists($name, $this->server_caps)) { @@ -1182,7 +1181,7 @@ class SMTP } $this->setError('HELO handshake was used; No information about server extensions available'); - return; + return null; } return $this->server_caps[$name]; diff --git a/wp-includes/version.php b/wp-includes/version.php index 96d3448c3e..7314916530 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52251'; +$wp_version = '5.9-alpha-52252'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.