Opened 4 years ago
Closed 4 years ago
#8347 closed defect (bug) (fixed)
The way we check PHPMailer v6 is available can generate errors
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 6.3.0 | Priority: | high |
Severity: | major | Version: | 6.2.0 |
Component: | Core | Keywords: | has-patch commit |
Cc: |
Description
We haven't identified this issue during 6.2.0-beta because to get these errors the Mailer class needs to be overriden using the bp_phpmailer_object
filter.
In this particular case, as we set the $phpmailer_is_6_0
check only if the Mailer class is not set, then we get an error as explained on this forum topic https://buddypress.org/support/topic/phpmailer-class-not-found/
To fix this issue, we need to set the $phpmailer_is_6_0
check immediately after we made sure the version 6 of PHPMailer is available (or in other words that WordPress is 5.5).
See attached patch.
Attachments (2)
Change History (8)
#2
@
4 years ago
Hi @dcavins
Here's how you can replicate the issue, add this code into a bp-custom.php file:
function override_bp_phpmailer_object() { if ( ! class_exists( 'PHPMailer\\PHPMailer\\PHPMailer' ) ) { require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php'; require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php'; require_once ABSPATH . WPINC . '/PHPMailer/Exception.php'; } $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true ); return $phpmailer; } add_filter( 'bp_phpmailer_object', 'override_bp_phpmailer_object' );
Then create a private group with a user and with another user, go to the group's landing page, and click on the Request membership Group's navigation (not the header's button).
You should see a fatal ;)
I'm not understanding the problem. What is the combination of factors that causes this error to arise? I'm not seeing it on my test installation.