Download & Extend

Module will produce serious errors on PHP versions older than 5.2.1

Project:MailChimp
Version:7.x-2.x-dev
Component:General
Category:task
Priority:major
Assigned:Unassigned
Status:needs review

Issue Summary

Hello!

Unfortunately -- and I don't know if this is a recent development, or not -- the Mailchimp module will always report that users were not subscribed to mailing lists (and probably other things), even though it goes through.

In the event that a user subscription is successful, the "/includes/mailchimp.inc" file will send the data to Mailchimp and pass along, if there are no errors, the $response->data value. If a user is successfully subscribed, the $response->data will be the string "true".

mailchimp.inc passes that response through drupal_json_decode() which passes it to json_decode(), which prior to PHP 5.2.1 will return a blank response instead of the integer "1". I've simply hacked my file to read:

if ($response->data == 'true') {
  $return = 1;
}
else {
  $return = drupal_json_decode($response->data);
}

And I think that might be a fine way to do it to ensure backwards compatibility.