Calling http://site/en/admin/config/services/mailchimp/signup triggers PHP Fatal error: Call to a member function getBody() on null in /var/www/htdocs/sites/all/libraries/mailchimp/src/Mailchimp.php on line 280

Line 280 (# PHP library for v3 of the MailChimp API):

throw new MailchimpAPIException($e->getResponse()->getBody(), $e->getCode(), $e);
CommentFileSizeAuthor
#7 php_fatal_error_call-2711785-7.patch495 bytesevilehk

Comments

sicher created an issue. See original summary.

jteeterxtreme’s picture

Getting the same error, this has been the only reference I've been able to find for it.
* Also getting this error at admin/config/services/mailchimp/lists

jteeterxtreme’s picture

I think I've figured it out, at least for the issue I was having. I was getting an SSL cert error witch was causing this exception, and had to update my php.ini

basically followed this: http://stackoverflow.com/questions/21114371/php-curl-error-code-60

then flushed my caches, then it started working. Good Luck!

sicher’s picture

Where did you get the SSL cert error? I don't see one in the Apache error log.

mohammed76’s picture

I am getting this error also on a lemp installation. anyone else found a solution?

sicher’s picture

Status: Active » Fixed

It's definitely a cert issue. You need older certificates:

http://stackoverflow.com/questions/22973701/ssl-errors-using-mailchimps-api

evilehk’s picture

Version: 7.x-4.1 » 8.x-1.x-dev
Status: Fixed » Needs review
StatusFileSize
new495 bytes

While it's true that the exception can be thrown because of cert issues, the exception is not being handled properly because it assumes that there is a response body. In the 8.x-1.x version, the library is bundled with the module, so I created a patch. The attached patch will pass the message from the Exception instead of the body of a potentially null object.

I made a GitHub pull request against the mailchimp-api-php library as well.

ruscoe’s picture

Status: Needs review » Fixed

Thanks for the patch, @evilehk. I left a comment on your GitHub pull request explaining why we couldn't use that exact solution and what the work-around was.

This should now work fine in the current 8.x-1.x-dev branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.