Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 175 of /var/www/html/sites/all/modules/entity/includes/entity.controller.inc)

It is weird for me, but in function mailchimp_lists_cron in mailchimp_lists.module @line 96:

    while ($item = $queue->claimItem() && $count < $batch_limit) {
      $account = user_load($item->data['uid']);
      $list = mailchimp_lists_load($item->data['list_id']);

Doesn't work, because $item equals true or fales, instead array claimItem function returns...

I changed code to this:

    while ($count < $batch_limit) {
      $item = $queue->claimItem();
      if (!$item) { 
        break;
      }
      $account = user_load($item->data['uid']);
      $list = mailchimp_lists_load($item->data['list_id']);

Basically I just moved $item = $queue->claimItem() out of while and it works perfect...

Any explanation why it is happening?

Comments

levelos’s picture

Status: Active » Closed (cannot reproduce)

Other than potentially corrupt data, I can't. I've also tested on PHP 3 and seems fine.

roam2345’s picture

This go me as well, closed issues http://drupal.org/node/1207390 and http://drupal.org/node/1206926 that are duplicates of this. 'patch' worked for me!

roam2345’s picture

Status: Closed (cannot reproduce) » Active

Reopening this as it is in fact failing for more details please view http://drupal.org/node/1207390, http://drupal.org/node/1206948 and http://drupal.org/node/1206926

Also php 5.3 on an ubuntu server if that helps. Please let me know what I can do to fast track this. If you need a more details server environment description, stack traces.. im all ears right now.

eusofzay’s picture

Version: 7.x-2.0-beta1 » 7.x-2.0-rc1

I want to add admin created user accounts to the list. For that I have chosen the Required list type and have also checked Sync List During Cron, but when I run cron get the following errors, repeated twenty times:

Notice: Trying to get property of non-object in mailchimp_lists_cron() (line 115 of /home/hl7org/public_html/sites/all/modules/mailchimp/modules/mailchimp_lists/mailchimp_lists.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /home/hl7org/public_html/includes/entity.inc).
Notice: Trying to get property of non-object in mailchimp_lists_cron() (line 116 of /home/hl7org/public_html/sites/all/modules/mailchimp/modules/mailchimp_lists/mailchimp_lists.module).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 175 of /home/hl7org/public_html/sites/all/modules/entity/includes/entity.controller.inc).
Notice: Trying to get property of non-object in mailchimp_lists_cron() (line 118 of /home/hl7org/public_html/sites/all/modules/mailchimp/modules/mailchimp_lists/mailchimp_lists.module).
Notice: Trying to get property of non-object in SystemQueue->deleteItem() (line 279 of /home/hl7org/public_html/modules/system/system.queue.inc).

roam2345’s picture

@eusofzay apply the patch above solves that.

eusofzay’s picture

Title: Fails on cron PHP 5.3 » My first ever patch

Thank you, it worked for me too.

he0x410’s picture

Title: My first ever patch » Fails on cron PHP 5.3

@eusofzay You renamed issue :)

@levelos It is not corrupted data, it is in fact, I debugged many times.

levelos’s picture

Status: Active » Fixed

Got it, thanks for the follow up. Resolved in commit #8d45f83018e62e3d287c682924f899ffb778b268.

Status: Fixed » Closed (fixed)

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