Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PHPMailer to 6.x #623

Merged
merged 26 commits into from
Oct 28, 2021
Merged

Update PHPMailer to 6.x #623

merged 26 commits into from
Oct 28, 2021

Conversation

mattyrob
Copy link
Collaborator

@mattyrob mattyrob commented Sep 9, 2020

Description

PHPMailer is not on ver 6.x with the 5.x only getting security fixes and remedial work for PHP notices.

WordPress moved to PHPMailer in version 5.5 and some further issues have been fixed since initial launch about 3 months ago now. These additional changes are included in the patch.

Motivation and context

PHPMailer 6.x is under active development and support and we should consider moving to the supported version.

How has this been tested?

Unit tests are included.
WordPress has already implement this change and ironed out a few glitches.
We should consider this a potential breaking change and therefore a good candidate for v2 ClassicPress

Screenshots

N/A

Types of changes

  • Enhancement of external library
  • Breaking change (potentially)

desrosj and others added 13 commits September 9, 2020 10:27
Now that WordPress Core supports PHP >= 5.6, the PHPMailer library can be updated to the latest version.

The PHPMailer files now reside in a new directory, `wp-includes/PHPMailer`. These files are copied verbatim from the library upstream and will make updating in the future easier. For backwards compatibility, the old files will remain and trigger deprecated file warnings.

The PHPMailer class is also now under the `PHPMailer\PHPMailer\PHPMailer` namespace. The `PHPMailer` class in the global namespace has been aliased for a seamless transition.

This upgrade also clears up a handful of PHP compatibility issues detailed in https://core.trac.wordpress.org/ticket/49922.

For a full list of changes, see the PHPMailer GitHub: PHPMailer/PHPMailer@v5.2.27...v6.1.6.

WP:Props Synchro, SergeyBiryukov, desrosj, donmhico, ayeshrajans.
Fixes https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- phpcs.xml.dist
- src/wp-includes/class-phpmailer.php
- src/wp-includes/pluggable.php
- tests/phpunit/includes/mock-mailer.php

---

Merges https://core.trac.wordpress.org/changeset/48033 / WordPress/wordpress-develop@0933882c6e to ClassicPress.
…ion` and `SMTP` to deprecated files to account for the new namespace.

This ensures backward compatibility with plugins using the old `class-phpmailer.php` or `class-smtp.php` files.

Follow-up to https://core.trac.wordpress.org/changeset/48033.

WP:Props Otto42.
Fixes https://core.trac.wordpress.org/ticket/50379. See https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- src/wp-includes/class-phpmailer.php

---

Merges https://core.trac.wordpress.org/changeset/48035 / WordPress/wordpress-develop@de4d6b454b to ClassicPress.
…ne string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Follow-up to https://core.trac.wordpress.org/changeset/46612, https://core.trac.wordpress.org/changeset/48033.

WP:Props davidbaumwald.
See https://core.trac.wordpress.org/ticket/31432, https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- tests/phpunit/tests/mail.php

---

Merges https://core.trac.wordpress.org/changeset/48443 / WordPress/wordpress-develop@43c193f58b to ClassicPress.
…ltiline string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Fixes https://core.trac.wordpress.org/ticket/31432. See https://core.trac.wordpress.org/ticket/42594, https://core.trac.wordpress.org/ticket/47411.

Conflicts:
- tests/phpunit/includes/abstract-testcase.php
- tests/phpunit/tests/blocks/render.php
- tests/phpunit/tests/dependencies/scripts.php
- tests/phpunit/tests/formatting/Autop.php
- tests/phpunit/tests/functions/getArchives.php
- tests/phpunit/tests/general/paginateLinks.php
- tests/phpunit/tests/pomo/po.php
- tests/phpunit/tests/post/listPages.php
- tests/phpunit/tests/post/template.php

---

Merges https://core.trac.wordpress.org/changeset/46612 / WordPress/wordpress-develop@b0419afba6 to ClassicPress.
This change also:
- introduces EOL ambivalent unit test assertions
- remove white space added to Content-Type email header in wp_mail()
@mattyrob
Copy link
Collaborator Author

mattyrob commented Sep 9, 2020

It looks like one of the unit tests for PHP 5.6 failed as PHP.net was inaccessible - perhaps a server blip?

@nylen
Copy link
Contributor

nylen commented Apr 21, 2021

Previously (on #279) we had planned this change for version 2.0.

Now that WP has adopted the latest version of PHPMailer, and these changes should have plenty of testing, perhaps we no longer need to wait.

I'm putting this PR in the 1.3.0-rc1 milestone so we can look at it there.

@nylen nylen added this to the 1.3.0-rc1 milestone Apr 21, 2021
@mattyrob
Copy link
Collaborator Author

I have been using PHPMailer 6 on a live site by implementing this patch directly and have not seen any issues in terms of changes to email layout or generation / delivery.

This applies to:
New User emails
Password reset requests
Comment moderation
Plugin generated emails

@mattyrob mattyrob added status: community reviewed Reviewed by a community member. type: feature request New feature or request labels Apr 28, 2021
@striebwj striebwj removed this from the 1.3.0-rc1 milestone Jul 5, 2021
@striebwj striebwj added this to the 1.4.0-rc1 milestone Jul 5, 2021
@ClassyBot
Copy link
Contributor

This pull request has been mentioned on ClassicPress Forums. There might be relevant details there:

https://forums.classicpress.net/t/work-towards-release-1-4-0/3305/1

@nylen
Copy link
Contributor

nylen commented Oct 28, 2021

I've added the two commits from https://core.trac.wordpress.org/ticket/53953 to upgrade to PHPMailer 6.5.1.

In general I think we should wait for WP to upgrade versions of external libraries and then just backport those changes. This is less work for us, we can take advantage of their testing, and we'll have those backports registered correctly.

@nylen nylen merged commit 0ce617d into ClassicPress:develop Oct 28, 2021
@mattyrob mattyrob deleted the Update/PHPMailer-6.x branch October 28, 2021 15:38
@ClassyBot
Copy link
Contributor

This pull request has been mentioned on ClassicPress Forums. There might be relevant details there:

https://forums.classicpress.net/t/classicpress-1-4-0-release-notes/3929/1

nylen added a commit that referenced this pull request Apr 1, 2022
nylen added a commit that referenced this pull request Apr 3, 2022
* Revert "Update PHPMailer to 6.x (#623)"

This reverts commit 0ce617d.

* Revert "Update Tinymce4 to 4.9.11 (#819)"

This reverts commit 996d2aa.

* Fix About page

* Fix issue with Theme Details modal
nylen added a commit that referenced this pull request Apr 3, 2022
mattyrob pushed a commit that referenced this pull request Apr 7, 2022
* Revert "Revert "Update Tinymce4 to 4.9.11 (#819)""

This reverts commit b43a83b.

* Revert "Revert "Update PHPMailer to 6.x (#623)""

This reverts commit 5344ddf.
mattyrob added a commit that referenced this pull request Apr 21, 2022
* Update PHPMailer to 6.5.3

* WP-r52811: External Libraries: Upgrade PHPMailer to version 6.6.0.

This is a minor feature release.

> Prior to this version, any OAuth provider needed to extend the provided `OAuth` base class, and this made it difficult to use with libraries other than ones based on the default [https://github.com/thephpleague/oauth2-client league] client packages. The OAuth property now accepts anything that implements the `OAuthProviderInterface`, making it much easier to use things like [https://github.com/googleapis/google-api-php-client Google's own OAuth classes]. Existing implementations that extend the provided `OAuth` base class will still work, as that base class now implements this interface too.
>
> When TLS errors occurred in PHPMailer, the error messages were often missing important info that might help diagnose/solve the problem. These error messages should now be more informative. A minor change is that a TLS error on SMTP connect will now throw an exception if exceptions are enabled.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.0

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.5.4...v6.6.0

Follow-up to https://core.trac.wordpress.org/changeset/50628, https://core.trac.wordpress.org/changeset/50799, https://core.trac.wordpress.org/changeset/51169, https://core.trac.wordpress.org/changeset/51634, https://core.trac.wordpress.org/changeset/51635, https://core.trac.wordpress.org/changeset/52252, https://core.trac.wordpress.org/changeset/52749.

WP:Props jrf, Synchro, miken32.
Fixes https://core.trac.wordpress.org/ticket/55277.

Conflicts:
- src/wp-includes/PHPMailer/PHPMailer.php
- src/wp-includes/PHPMailer/SMTP.php

---

Merges https://core.trac.wordpress.org/changeset/52811 / WordPress/wordpress-develop@44122bf7df to ClassicPress.

* Fix backport conflicts from 52811

* Possible fix for edge case PHPMailer SMTP errors

* Update PHPMailer to 6.x (#623)

* WP-r48033: External Libraries: Upgrade PHPMailer to version 6.1.6.

Now that WordPress Core supports PHP >= 5.6, the PHPMailer library can be updated to the latest version.

The PHPMailer files now reside in a new directory, `wp-includes/PHPMailer`. These files are copied verbatim from the library upstream and will make updating in the future easier. For backwards compatibility, the old files will remain and trigger deprecated file warnings.

The PHPMailer class is also now under the `PHPMailer\PHPMailer\PHPMailer` namespace. The `PHPMailer` class in the global namespace has been aliased for a seamless transition.

This upgrade also clears up a handful of PHP compatibility issues detailed in https://core.trac.wordpress.org/ticket/49922.

For a full list of changes, see the PHPMailer GitHub: PHPMailer/PHPMailer@v5.2.27...v6.1.6.

WP:Props Synchro, SergeyBiryukov, desrosj, donmhico, ayeshrajans.
Fixes https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- phpcs.xml.dist
- src/wp-includes/class-phpmailer.php
- src/wp-includes/pluggable.php
- tests/phpunit/includes/mock-mailer.php

---

Merges https://core.trac.wordpress.org/changeset/48033 / WordPress/wordpress-develop@0933882c6e to ClassicPress.

* Fix conflicts from 48033

* WP-r48035: External Libraries: Add class aliases for `phpmailerException` and `SMTP` to deprecated files to account for the new namespace.

This ensures backward compatibility with plugins using the old `class-phpmailer.php` or `class-smtp.php` files.

Follow-up to https://core.trac.wordpress.org/changeset/48033.

WP:Props Otto42.
Fixes https://core.trac.wordpress.org/ticket/50379. See https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- src/wp-includes/class-phpmailer.php

---

Merges https://core.trac.wordpress.org/changeset/48035 / WordPress/wordpress-develop@de4d6b454b to ClassicPress.

* Fix conflicts from 48035

* WP-r48058: Build/Test Tools: Prevent double `/`s when including PHPMailer files.

`ABSPATH` includes a trailing slash already.

Follow up of https://core.trac.wordpress.org/changeset/48033.
WP:Props desrosj.
See https://core.trac.wordpress.org/ticket/50377, https://core.trac.wordpress.org/ticket/41750.

---

Merges https://core.trac.wordpress.org/changeset/48058 / WordPress/wordpress-develop@6334056f65 to ClassicPress.

* WP-r48443: Tests: Ignore EOL differences in email tests using multiline string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Follow-up to https://core.trac.wordpress.org/changeset/46612, https://core.trac.wordpress.org/changeset/48033.

WP:Props davidbaumwald.
See https://core.trac.wordpress.org/ticket/31432, https://core.trac.wordpress.org/ticket/41750.

Conflicts:
- tests/phpunit/tests/mail.php

---

Merges https://core.trac.wordpress.org/changeset/48443 / WordPress/wordpress-develop@43c193f58b to ClassicPress.

* Fix conflics from 48443

* WP-r48530: Mail: Make sure the `PHPMailer` class is only required once if a plugin requires `wp-includes/class-phpmailer.php` directly.

Follow-up to https://core.trac.wordpress.org/changeset/48033.

WP:Props david.binda.
Fixes https://core.trac.wordpress.org/ticket/50716. See https://core.trac.wordpress.org/ticket/41750.

---

Merges https://core.trac.wordpress.org/changeset/48530 / WordPress/wordpress-develop@99f5b6019a to ClassicPress.

* Update PHPMailer to 6.1.7

This is a maintenance release
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.1.7

* WP-r46612: Build/Test Tools: Ignore EOL differences in tests using multiline string assertions.

Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Fixes https://core.trac.wordpress.org/ticket/31432. See https://core.trac.wordpress.org/ticket/42594, https://core.trac.wordpress.org/ticket/47411.

Conflicts:
- tests/phpunit/includes/abstract-testcase.php
- tests/phpunit/tests/blocks/render.php
- tests/phpunit/tests/dependencies/scripts.php
- tests/phpunit/tests/formatting/Autop.php
- tests/phpunit/tests/functions/getArchives.php
- tests/phpunit/tests/general/paginateLinks.php
- tests/phpunit/tests/pomo/po.php
- tests/phpunit/tests/post/listPages.php
- tests/phpunit/tests/post/template.php

---

Merges https://core.trac.wordpress.org/changeset/46612 / WordPress/wordpress-develop@b0419afba6 to ClassicPress.

* Fix conflicts in unit tests
This change also:
- introduces EOL ambivalent unit test assertions
- remove white space added to Content-Type email header in wp_mail()

* Fix test error in Tests_List_Pages suit - revert to current test code

* Additional fix to the Tests_List_Pages suit to repair a non-asserting test after a poor conflict repair

* WP-r49034: External Libraries: Upgrade PHPMailer to version 6.1.7.

For a full list of changes in this update, see the PHPMailer GitHub: PHPMailer/PHPMailer@v6.1.6...v6.1.7.

WP:Props ayeshrajans, jrf.
Fixes https://core.trac.wordpress.org/ticket/51311.

---

Merges https://core.trac.wordpress.org/changeset/49034 / WordPress/wordpress-develop@45197f9d4e to ClassicPress.

* WP-r49136: External Libraries: Upgrade PHPMailer to version 6.1.8.

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.1.7...v6.1.8

WP:Props ayeshrajans.
Fixes https://core.trac.wordpress.org/ticket/51502.

---

Merges https://core.trac.wordpress.org/changeset/49136 / WordPress/wordpress-develop@3021eff927 to ClassicPress.

* WP-r49713: External Libraries: Upgrade PHPMailer to version 6.2.0.

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.1.8...v6.2.0

WP:Props ayeshrajans, jrf.
Fixes https://core.trac.wordpress.org/ticket/51874.

---

Merges https://core.trac.wordpress.org/changeset/49713 / WordPress/wordpress-develop@0d53804ea3 to ClassicPress.

* Backport of fix in changeset 50022

* Update PR to PHPMailer 6.3.0

* Update PHPMailer to 6.4 release

See release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.4.0

* Update PHPMailer to 6.4.1 - includes CVE fixes
See https://github.com/PHPMailer/PHPMailer/releases/tag/v6.4.1

* WP-r51169: External Libraries: Upgrade PHPMailer to version 6.5.0.

Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.0

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.4.1...v6.5.0

WP:Props ayeshrajans, Synchro.
Fixes https://core.trac.wordpress.org/ticket/53430.

---

Merges https://core.trac.wordpress.org/changeset/51169 / WordPress/wordpress-develop@77adbdf376 to ClassicPress.

* Update PHPMailer to 6.5.1 - contains code improvements and provisional support for PHP 8.1
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.1

* WP-r51634: 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:
PHPMailer/PHPMailer@v6.5.0...v6.5.1

Follow-up to https://core.trac.wordpress.org/changeset/50628, https://core.trac.wordpress.org/changeset/50799, https://core.trac.wordpress.org/changeset/51169.

WP:Props jrf.
Fixes https://core.trac.wordpress.org/ticket/53953.

---

Merges https://core.trac.wordpress.org/changeset/51634 / WordPress/wordpress-develop@9aa1589807 to ClassicPress.

* WP-r51635: External Libraries: Restore the `phpcs:ignore` statements in PHPMailer.

These are necessary for a passing PHP Compatibility scan.

Follow-up to https://core.trac.wordpress.org/changeset/48045, https://core.trac.wordpress.org/changeset/51634.

See https://core.trac.wordpress.org/ticket/53953.

---

Merges https://core.trac.wordpress.org/changeset/51635 / WordPress/wordpress-develop@7d88c013f4 to ClassicPress.

Co-authored-by: Jonathan Desrosiers <desrosj@git.wordpress.org>
Co-authored-by: Sergey Biryukov <sergeybiryukov@git.wordpress.org>

* WP-r52811: External Libraries: Upgrade PHPMailer to version 6.6.0.

This is a minor feature release.

> Prior to this version, any OAuth provider needed to extend the provided `OAuth` base class, and this made it difficult to use with libraries other than ones based on the default [https://github.com/thephpleague/oauth2-client league] client packages. The OAuth property now accepts anything that implements the `OAuthProviderInterface`, making it much easier to use things like [https://github.com/googleapis/google-api-php-client Google's own OAuth classes]. Existing implementations that extend the provided `OAuth` base class will still work, as that base class now implements this interface too.
>
> When TLS errors occurred in PHPMailer, the error messages were often missing important info that might help diagnose/solve the problem. These error messages should now be more informative. A minor change is that a TLS error on SMTP connect will now throw an exception if exceptions are enabled.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.0

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.5.4...v6.6.0

Follow-up to https://core.trac.wordpress.org/changeset/50628, https://core.trac.wordpress.org/changeset/50799, https://core.trac.wordpress.org/changeset/51169, https://core.trac.wordpress.org/changeset/51634, https://core.trac.wordpress.org/changeset/51635, https://core.trac.wordpress.org/changeset/52252, https://core.trac.wordpress.org/changeset/52749.

WP:Props jrf, Synchro, miken32.
Fixes https://core.trac.wordpress.org/ticket/55277.

Conflicts:
- src/wp-includes/PHPMailer/PHPMailer.php
- src/wp-includes/PHPMailer/SMTP.php

---

Merges https://core.trac.wordpress.org/changeset/52811 / WordPress/wordpress-develop@44122bf7df to ClassicPress.

* Fix merge conflicts from backport of 52811

* Possible fix for edge case PHPMailer SMTP errors

* WP-r52749: External Libraries: Upgrade PHPMailer to version 6.5.4.

The latest release includes some minor PHP cross-version improvements and a safeguard against hosters disabling security functions. Note to hosting providers: don't disable `escapeshellarg()` and `escapeshellcmd()`; it's not safe!

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.5.4

For a full list of changes in this update, see the PHPMailer GitHub:
PHPMailer/PHPMailer@v6.5.3...v6.5.4

Follow-up to https://core.trac.wordpress.org/changeset/50628, https://core.trac.wordpress.org/changeset/50799, https://core.trac.wordpress.org/changeset/51169, https://core.trac.wordpress.org/changeset/51634, https://core.trac.wordpress.org/changeset/51635, https://core.trac.wordpress.org/changeset/52252.

WP:Props jrf, Synchro.
Fixes https://core.trac.wordpress.org/ticket/55187.

Conflicts:
- src/wp-includes/PHPMailer/PHPMailer.php
- src/wp-includes/PHPMailer/SMTP.php

---

Merges https://core.trac.wordpress.org/changeset/52749 / WordPress/wordpress-develop@9a6179e941 to ClassicPress.

* Fix merge conflicts from backport of 52749

* Comparison to official 6.6.0

File comparison and changes made from comparison to official PHPMailer release:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.0

* Basic test for PHPMailer changes required for CP

* Better document edits to PHPMailer and `require_once` without parentheses

Co-authored-by: Sergey Biryukov <sergeybiryukov@git.wordpress.org>
Co-authored-by: Jonathan Desrosiers <desrosj@git.wordpress.org>
@viktorix viktorix added the exclude For filtering purposes only. label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude For filtering purposes only. status: community reviewed Reviewed by a community member. type: feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade PHPMailer
7 participants