#50379 closed defect (bug) (fixed)
PHPMailer update introduces minor backcompat issue with phpmailerException and SMTP
Reported by: | Otto42 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | External Libraries | Keywords: | has-patch has-dev-note |
Focuses: | Cc: |
Description (last modified by )
[48033] for #41750 replaces the old PHPMailer with the newer version.
In place of the old version, the class-phpmailer.php and class-smtp.php files are deprecated and load the new code, along with adding a class alias.
However, the old class-phpmailer.php file defined both the PHPMailer class, and the phpmailerException class. This means the new one should too.
Recommend adding this to class-phpmailer.php:
require __DIR__ . '/PHPMailer/Exception.php';
and
class_alias( PHPMailer\PHPMailer\Exception::class, 'phpmailerException' );
Similarly, the class-smtp.php is now loading the new file, but it is missing the class alias to account for the namespace. So it should probably have this in it:
class_alias( PHPMailer\PHPMailer\SMTP::class, 'SMTP' );
These aliases would only be needed if these files were loaded, any plugin that relies on them should update to the more direct file includes, and account for the namespaces themselves at that time. The aliases are therefore only for backwards compatibility.
Attachments (1)
Change History (8)
#7
@
4 years ago
- Keywords has-dev-note added; needs-dev-note removed
This was detailed in the following dev note: https://make.wordpress.org/core/2020/07/01/external-library-updates-in-wordpress-5-5-call-for-testing/
In 48035: