Here we still have a prolem with the interests as they come without group-level from the API. So the inner foreach must throw a warning as you can see on the attached screenshot. There was a similir issue in 7.3 - discussed here: https://www.drupal.org/node/2632568

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zuernBernhard created an issue. See original summary.

zuernBernhard’s picture

Rodeo.be’s picture

I have tihs issue as well .. any solutions?

drumm’s picture

Title: Warning: Invalid argument supplied for foreach() in mailchimp_update_local_cache() (line 674 of /sites/all/modules/contrib/mailchimp/mailchimp.module) » Warning: Invalid argument supplied for foreach() in mailchimp_update_local_cache()
Assigned: Unassigned » drumm
Issue tags: +affects drupal.org

We turned on batch processing for www.drupal.org, and started running into this with a mailchimp_lists field, running 7.x-5.1.

This causes the interests to not properly cache, so they all appear cleared if you go back to the form, until cron runs.

drumm’s picture

FileSize
815 bytes

The data I’m seeing come through to $args['interests'] is

Array
(
    [22e1b642b7] => 1
    [a0d7a1c02b] => 1
    [dc0ad3fd6d] => 1
    [3374b1dd84] => 
    [53d7f4209a] => 
    [faceb9a270] => 
    …
)

So I’m using PHP’s loose comparison, if ($interests). Otherwise this is the same as zuernBernhard’s patch, with minor code style cleanup.

drumm’s picture

Status: Active » Needs review
drumm’s picture

Version: 7.x-4.x-dev » 7.x-5.x-dev
rjacobsen0’s picture

Status: Needs review » Closed (duplicate)

This issue is a duplicate of https://www.drupal.org/project/mailchimp/issues/2838871. Contributors here have been credited.

drumm’s picture

Status: Closed (duplicate) » Needs review
FileSize
824 bytes

Reopening since the fix in #2838871-25: "Invalid argument supplied for foreach() in mailchimp_lists_process_subscribe_form_choices()" error prevents interest group subscriptions/updates didn’t look quite right.

This updates the if condition to match the patch in this issue. $interest_group is an array key which will never be itself an array. is_array($interests) should be the right thing to be checking.

  • drumm authored 38cc417 on 7.x-5.x
    Issue #2857646 by drumm, zuernBernhard: Warning: Invalid argument...

  • drumm authored 5ddf97b on 7.x-4.x
    Issue #2857646 by drumm, zuernBernhard: Warning: Invalid argument...
samuel.mortenson’s picture

Status: Needs review » Fixed

Thanks @drumm, LGTM.

Status: Fixed » Closed (fixed)

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