• Resolved revaxarts

    (@revaxarts)


    I’m getting a fatal error if a third party plugin “highjacks” the native wp_mail function and CF7 sends a mail.

    I’ve tracked down the issue to line 561 in includes/classes.php where you prevent errors with this line
    return @wp_mail( $recipient, $subject, $body, $headers, $attachments );

    while it should be
    return wp_mail( $recipient, $subject, $body, $headers, $attachments );

    appending @ is bad practice in general

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 7 replies - 1 through 7 (of 7 total)
  • I am experiencing this. Would love for CF7 to fix this issue.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    I’m getting a fatal error if a third party plugin “highjacks” the native wp_mail function and CF7 sends a mail.

    What fatal error do you see? What third party plugin do you mean?

    Thread Starter revaxarts

    (@revaxarts)

    Fatal error: Call to a member function get() on a non-object in wp-includes/cache.php on line 113 (wp 3.6.1)

    I guess this error is not directly related to one of the plugins however removing the at sign doesn’t throw that error.

    You may can use a try-catch block to handle errors

    I’m referring to the MyMail Newsletter Plugin

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Read the description of PHP’s error control operator. It is for controlling errors, not for throwing ones. I couldn’t read the reason in your comments why you thought the error was relating to the @ operator.

    Thread Starter revaxarts

    (@revaxarts)

    Yes, you’re right but I have no idea why this error came up. I don’t use the cache in this part.

    I though using try-catch would do the same in this particular case

    try{
    		return wp_mail( $recipient, $subject, $body, $headers, $attachments );
    	} catch ( Exception $e) {
    		return false;
    	}

    I would solve that problem if I know were to start from ??

    Thread Starter revaxarts

    (@revaxarts)

    Ok, found the problem.

    Was a call to set_transient within a _destruct method of a class in my plugin.

    Anyhow it’s strange that this error only came up if you suppress errors!?

    Thanks for your effort!

    Oops. It was not CF7 to blame.
    Thanks to both of you for your efforts!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Suppress errors with "@" before wp_mail causes errors in third party plugins’ is closed to new replies.