[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
Tue Nov 4 17:19:12 UTC 2025


#33972: static use of PHPMailer class results in stale state between calls to
wp_mail()
-------------------------------------------------+-------------------------
 Reporter:  codebuddy                            |       Owner:  rishabhwp
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.9
Component:  Mail                                 |     Version:  4.3
 Severity:  critical                             |  Resolution:  fixed
 Keywords:  has-test-info good-first-bug has-    |     Focuses:
  patch has-unit-tests                           |
-------------------------------------------------+-------------------------
Changes (by johnjamesjacoby):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61131" 61131]:
 {{{
 #!CommitTicketReference repository="" revision="61131"
 Mail: reset `Encoding` to 8-bit in `wp_mail()`.

 The PHPMailer library may automatically switch its encoding based on
 various internal factors.

 This commit fixes a bug where the `$phpmailer` global was unintentionally
 persisting its `Encoding` property from the first `wp_mail()` call to all
 subsequent calls.

 This includes unit tests to verify the fix is accurate, and a change to
 the mock-mailer helper that worked around this bug just-in-time when
 running the test suite.

 Props codebuddy, dilip2615, rishabhwp, sajjad67, sirlouen, stephenharris.

 Fixes #33972.
 }}}

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


More information about the wp-trac mailing list