BUG REPORT WITH SUGGESTED FIX – Unexpected token <
-
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://www.ads-software.com/plugins/contact-form-7-mailchimp-extension/
- The topic ‘BUG REPORT WITH SUGGESTED FIX – Unexpected token <’ is closed to new replies.