Title: Errors filling logs
Last modified: February 21, 2020

---

# Errors filling logs

 *  Resolved [Jacob Peattie](https://wordpress.org/support/users/jakept/)
 * (@jakept)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/errors-filling-logs/)
 * Hi,
 * We’re currently seeing a few errors from this plugin filling up our logs. It 
   would be great if the issue could be resolved to stop these warnings:
 * `PHP Warning: Invalid argument supplied for foreach() in .../public_html/wp-content/
   plugins/mailchimp-for-woocommerce/bootstrap.php on line 251`
 * I found a topic with a similar message here:
 * [https://wordpress.org/support/topic/invalid-argument-supplied-error-4/](https://wordpress.org/support/topic/invalid-argument-supplied-error-4/)
 * We haven’t experienced any issues with the plugin’s functionality, but even if
   the issue was that our server is “being blacklisted by the API gateway”, that’s
   not something that should throw a PHP warning. The plugin should be checking 
   that the value is correct before using `foreach()`, if there’s a possibility 
   that it’s not.
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [ryanhungate](https://wordpress.org/support/users/ryanhungate/)
 * (@ryanhungate)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/errors-filling-logs/#post-12465533)
 * [@jakept](https://wordpress.org/support/users/jakept/) this seems to be related
   to the API returning a NULL response. After checking into this method, we’re 
   actually going to not only fix the type check but we’ll also optimize this so
   it’s not calling the API so often. Stay tuned for 2.3.4 release – it’s already
   in active development, but there’s no guarantee on this release date just yet.
 * For now, if you needed to update the plugin for this to silence itself, we can
   just simply wrap it like this:
 *     ```
       $stores = $api->stores();
       if (!empty($stores)) {
           //iterate thru stores, find correct store ID and save it to db
           foreach ($stores as $mc_store) {
               if ($mc_store->getDomain() === get_option('siteurl')) {
                   update_option('mailchimp-woocommerce-store_id', $mc_store->getId(), 'yes');
                   $store_id = $mc_store->getId();
               }
           }
       }
       ```
   
 * Thanks for bringing this one up – the API is supposed to return an array there
   and it’s probably returning NULL for some reason. We’ll get this fixed up 🙂
    -  This reply was modified 6 years, 3 months ago by [ryanhungate](https://wordpress.org/support/users/ryanhungate/).
 *  Thread Starter [Jacob Peattie](https://wordpress.org/support/users/jakept/)
 * (@jakept)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/errors-filling-logs/#post-12475912)
 * I looked closer and it turns out the plugin wasn’t functioning after all, the
   client just hadn’t reported a problem. I think my point about the error still
   stands though, but it sounds like you’re on top of it, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Errors filling logs’ is closed to new replies.

 * ![](https://ps.w.org/mailchimp-for-woocommerce/assets/icon-256x256.png?rev=1509501)
 * [Mailchimp for WooCommerce](https://wordpress.org/plugins/mailchimp-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jacob Peattie](https://wordpress.org/support/users/jakept/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/errors-filling-logs/#post-12475912)
 * Status: resolved