[wp-trac] [WordPress Trac] #33972: static use of PHPMailer class results in stale state between calls to wp_mail()

WordPress Trac noreply at wordpress.org
Sun Jul 13 21:08:31 UTC 2025


#33972: static use of PHPMailer class results in stale state between calls to
wp_mail()
---------------------------------------+---------------------
 Reporter:  codebuddy                  |       Owner:  (none)
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:
Component:  Mail                       |     Version:  4.3
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch has-test-info  |     Focuses:
---------------------------------------+---------------------
Changes (by SirLouen):

 * keywords:  needs-patch => needs-patch has-test-info


Comment:

 == Reproduction Report
 === Description
 ✅ This report validates that the issue can be reproduced still 10 years
 after.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.2.29
 - Server: nginx/1.29.0
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 138.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Micro Email Testing 1.0.0

 === Testing Instructions
 1. I've used the script I provide in the bottom
 2. 🐞 The second email is sent with `Content-Transfer-Encoding: quoted-
 printable` header

 === Actual Results
 1.  ✅ Error condition occurs (reproduced).

 === Additional Notes
 - I've noted that the unit test provided does the other way around. First
 test fails with `8bit`

 {{{
 1) Tests_Pluggable_wpMail::test_wp_mail_encoding_does_not_bleed
 Failed asserting that two strings are equal.
 --- Expected
 +++ Actual
 @@ @@
 -'quoted-printable'
 +'8bit'
 }}}

 - Probably this report has not progressed in all this time because a 1000
 char word is very unlikely to happen.

 === Supplemental Artifacts
 Testing script:

 {{{
 $to = 'test at example.com';
 $subject = "Subject";
 $body = str_repeat( 'A', 1000 );

 if ( wp_mail( $to, $subject, $body) ) {
         echo 'Message 1 successfully sent.';
 } else {
         echo '>Message 1 sending failed.';
 }

 $to = 'test at example.com';
 $subject = "Subject B";
 $body = "Hello";

 if ( wp_mail( $to, $subject, $body) ) {
         echo 'Message 2 successfully sent.';
 } else {
         echo 'Message 2 sending failed.';
 }
 }}}

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


More information about the wp-trac mailing list