Hey guys,

I have just upgraded my Drupal 6 to Drupal 7, everything looks fine, except that when I'm viewing nodes from some content types I created I see this:

    Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /path/to/drupal/includes/entity.inc).
    Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /path/to/drupal/includes/entity.inc).

How can I fix this?

Thanks

Comments

jfha73’s picture

I just noticed that this is only happening when there is a link field in the node.

jfha73’s picture

Disregard my last comment, it's happening to more people with or without link module so it must be something else.

jfha73’s picture

Version: 7.14 » 7.15
Category: support » bug

Hey guys,

I found that adding array_filter to these two lines solves the warnings showing up, you might want to consider adding it in future versions.

This is what I changed it to and it works:

File: entity.inc

Line 178 - $passed_ids = !empty($ids) ? array_flip(array_filter($ids, 'strlen')) : FALSE;
Line 354 - $entities += array_intersect_key($this->entityCache, array_flip(array_filter($ids, 'strlen')));
aspilicious’s picture

This is probably caused by a broken contrib module. Turn of some modules untill you found the broken module and report your issue there.

Don't hack entity.inc...

jfha73’s picture

I have been trying, but the module I thought was the cause, it was not, besides I have not seen any good info to lead me to the correct answer, so all I could do was that, until I can find an answer for it.

Thanks for the advice though.

jfha73’s picture

This is the thing I'm only getting these warnings when viewing nodes that have the following Modules/Fields:

Link
Date
Taxonomy terms

AFTER upgrading from D6, I just created a new Content type with link and Date fields and it works just fine, which tells me there must be something done during upgrade or with Taxonomy, because I just noticed this appears in the Logs:

Notice: Undefined index: tid in taxonomy_field_formatter_prepare_view() (line 1580 of /path/to/drupal/modules/taxonomy/taxonomy.module).

Along with the warning.

aspilicious’s picture

Auwch. Its probably to much work to recreate the taxonomy fields?

jfha73’s picture

Status: Active » Closed (works as designed)

Got it to work by going to the Manage Display of the content type showing the warning and changing the Format of the field(s) with the problem, then changing it back to where it was before.

jfha73’s picture

Issue summary: View changes

correcting a typo