[wp-trac] [WordPress Trac] #50379: PHPMailer update introduces minor backcompat issue with phpmailerException and SMTP

WordPress Trac noreply at wordpress.org
Fri Jun 12 19:43:22 UTC 2020


#50379: PHPMailer update introduces minor backcompat issue with phpmailerException
and SMTP
--------------------------------+------------------------------
 Reporter:  Otto42              |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  External Libraries  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------
Description changed by Otto42:

Old description:

> [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
> to.
>
> Recommend adding this to class-phpmailer.php:
>
> `require __DIR__ . '/PHPMailer/PHPMailer.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.

New description:

 [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.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50379#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list