[wp-trac] [WordPress Trac] #41750: Update PHPMailer to 6.0
WordPress Trac
noreply at wordpress.org
Fri Feb 7 19:15:09 UTC 2020
#41750: Update PHPMailer to 6.0
-------------------------------------------------+-------------------------
Reporter: Synchro | Owner:
| SergeyBiryukov
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.4
Component: External Libraries | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-dev- | Focuses:
note early |
-------------------------------------------------+-------------------------
Comment (by ayeshrajans):
The tests fail because the `PHPMailer/Exception` class is not loaded. This
is new from the current version, so we need to manually `require` this
class in addition to the `class-phpmailer.php` file.
This patch takes a slightly new approach:
1. Instead of updating `src/wp-includes/class-smtp.php` and `class-
phpmailer.php` files, this patch creates a new directory `src/wp-
includes/PHPMailer/` and adds verbatim `PHPMailer.php`, `SMTP.php`, and
`POP3.php` classes. There is a new exception class at `Exception.php`,
which is included as well.
2. To maintain BC, existing `src/wp-includes/class-smtp.php`, `class-
phpmailer.php`, and `class-pop3.php` files require the new files.
3. PHPMailer uses the `PHPMailer\PHPMailer\Exception` as the exception
class. This is updated in `pluggable.php` file. We use Fully-Qualified
Class Names (FQCN) here because using FQCN doesn't pollute the header of
`pluggable.php` class.
4. In this patch, **all** tests related to PHPMailer and SMTP are passing.
However, the new `POP3.php` class is not exactly an easy migrate, nor I
have personally done it before. Help welcome.
5. It also updated the mail mockup file to use the new file paths.
So far, this patch fixes all but one test related to mail-fetching from
`./wp-mail.php` file.
This will break the `phpcs.xml` ignore list because PHPMailer is in a new
path. This can be fixed with a patch similar to that updates the
`phpcs.xml` file. It is also attached to this ticket.
Future plans:
1. We will need more test coverage because right now, all PHPMailer-thrown
exceptions are silently ignored. This is a bad practice, and ideally
should be handled in a layer above.
2. The POP3 functionality doesn't appear to have enough tests.
CI results: https://travis-ci.org/Ayesh/wordpress-develop/jobs/647470540
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41750#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list