Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding or editing a user account I get this error:
warning: Invalid argument supplied for foreach() in /XXXXXX/public/sites/all/modules/mailchimp/mailchimp.module on line 914.
Comments
Comment #1
jerry CreditAttribution: jerry commentedYep, I just noticed this, too.
Comment #2
levelos CreditAttribution: levelos commentedI can't recreate. Can you provide more specific details? Thanks.
Comment #3
jerry CreditAttribution: jerry commentedWish I could; I've just seen it from time to time in the log during a cron run, apparently during a mailing list sync.
Comment #4
Clint Eagar CreditAttribution: Clint Eagar commentedHere are some log entries:
It looks like the module is referencing old lists. I was using a test Mailchimp account in development and then switched to a different in production.
Comment #5
plamondonl CreditAttribution: plamondonl commentedI have the same error and I me too I upgraded from an older version of the module (Mailchimp 2.2 to 2.4). In 2.2, variable_get('mailchimp_lists', array()) returns a serialized array and it is unserialized before being passed to the foreach loop in _mailchimp_get_available_lists(). In 2.4, I suppose variable 'mailchimp_lists' is no longer serialized because there is no unserialize() call before the foreach loop. In my case, the content of 'mailchimp_lists' is still serialized so that's why a warning is produced when using 2.4. I guess there is nothing to fix. I'll just uninstall and reinstall the module properly.
Comment #6
Gabriel R. CreditAttribution: Gabriel R. commentedSame problem here. After an upgrade, the mailing links are no longer listes in the module config page. The subscription option is however still present in the user account. Enabling the ghost newsletter returns the error "warning: Invalid argument supplied for foreach() in /.../sites/all/modules/mailchimp/mailchimp.module on line 914.
My problem is that the newsletters are gone from config.
Comment #7
kenwen CreditAttribution: kenwen commentednot sure if this is related but i get this error on user sign up
Duplicate entry '11' for key 1 query: INSERT INTO mailchimp_user (uid, status) VALUES (11, 'pending') in /xxx/mailchimp.module on line 113
Comment #8
levelos CreditAttribution: levelos commentedUpdate mailchimp_update_6203() should take care of the migration from serialized to unserialized storage. If you have any issue, try just re-saving your settings at admin/config/mailchimp.
Comment #9
javier1968 CreditAttribution: javier1968 commentedI also have the same issue even when I installed the latest version from scratch with no update required.
http://www.tyndall.ac.uk/mailchimp/subscribe
Comment #10
ahmu83 CreditAttribution: ahmu83 commentedThe error caused is due to passing a non-array variable to foreach on line # 927
foreach ($mergevars as $mergevar) {
I have wrapped that foreach loop in an array check
this fixed the problem but not sure how it will affect the functionality.