Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/21/2016 05:36:26 PM (6 years ago)
Author:
djpaul
Message:

Emails: fix fatal errors when sending emails with old versions of WordPress (<4.3).

An upstream change in WordPress #WP25560 updated the version of
PHPMailer bundled with WordPress, from version 5.2.4 to 5.2.7. Prior to
that change, it was also impossible to use PHPMailer directly (outside
of wp_mail()) due to how PHPMailer was/is bundled with WordPress. The
PHPMailer change that concerns us is in PHPMailer->html2text(). A
parameter to use "advanced HTML-to-text conversion" was a bool, but in
the later version, it was changed to a callable parameter.

All of the above, combined with PHP's handling of truthy variables,
meant we were triggering the PHPMailer bug, responsible for the fatal
errors, on sites running old version of WordPress.

Fortunately, the fix is simple. We can remove our custom HTML-to-text
conversion parameter as it doesn't actually matter because we always
explicitly set the plain text version of the email content, after
PHPMailer runs its built-in HTML-to-text conversion function,
regardless of whether BuddyPress sends emails in plain text or HTML.

Fixes #6970

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-phpmailer.php

    r10639 r10670  
    6666
    6767        if ( $email->get( 'content_type' ) === 'html' ) {
    68             $phpmailer->msgHTML( $email->get_template( 'add-content' ), '', 'wp_strip_all_tags' );
     68            $phpmailer->msgHTML( $email->get_template( 'add-content' ) );
    6969            $phpmailer->AltBody = $content_plaintext;
    7070
Note: See TracChangeset for help on using the changeset viewer.