• Resolved rtpHarry

    (@rtpharry)


    Renzo,

    I was hit with the “Unexpected token <” issue that seems to have been sporadically affecting many users of your plugin.

    I have figured out the reason why it was only happening sometimes and for some people.

    The actual json being returned was:

    <br />
    <b>Notice</b>:  Undefined index: logfileEnabled in <b>/var/sites/clientname.co.uk/public_html/wp-content/plugins/contact-form-7-mailchimp-extension/lib/functions.php</b> on line <b>260</b><br />
    {"mailSent":true,"into":"#wpcf7-f278-p27-o2","captcha":null,"message":"Your message was sent successfully. Thanks."}

    Digging into it, it seems that it happens when you have the show errors enabled with PHP and you have debug logging disabled with the plugin.

    For me it was a simple fix to change the line from:

    $logfileEnabled = $cf7_mch['logfileEnabled'];

    To:

    $logfileEnabled = isset($cf7_mch['logfileEnabled']) ? $cf7_mch['logfileEnabled'] : null;

    After that the plugin submit worked for me.

    Hopefully you can incorporate this into your next version 🙂

    Looking at the code you might even be able to merge that with the line right after it but I just wanted to get a quick fix in there.

    https://wordpress.org/plugins/contact-form-7-mailchimp-extension/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    FYI, this bug still exists in the latest version of the plug-in, and it’s been causing some issues lately until it has come to our intention after investigating the reason behind multiple form submissions.

    Thanks @rtpharry.

    Regards

    Plugin Author Renzo Johnson

    (@rnzo)

    Please download the latest release.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘BUG REPORT WITH SUGGESTED FIX – Unexpected token <’ is closed to new replies.