I get this warning on a node/add page.

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 64 of /mnt/stor2-wc1-dfw1/394720/www.ivaw.org/web/content/sites/all/modules/entitycache/entitycache.module).

Comments

nerilka’s picture

Hi
I got the same when I create a relationship from a content-with-an-entity-reference-field referencing some contents.

catch’s picture

Status: Active » Closed (cannot reproduce)

This isn't a bug in entitycache, it only happens if a module calls entity_load() with the wrong arguments, and will be the same with entitycache disabled. Please open bug reports with the contrib module causing the warning.

reubenavery’s picture

Status: Closed (cannot reproduce) » Needs review
StatusFileSize
new476 bytes

@catch, yes you are correct.. i'm seeing a lot of this happening from file_entity, for example. it's passing an $ids argument of array(0 => NULL) to EntityCacheControllerHelper::entityCacheLoad()

attached is a patch that will apply an array_filter against this and eliminates errors being kicked up.

reubenavery’s picture

StatusFileSize
new541 bytes

The patch in #3 fails in the case of an $id arg being equal to 0 as in the case of anonymous user #0.

Here's a correction that filters out anything that is neither numeric or a string.

catch’s picture

Issue summary: View changes
Status: Needs review » Closed (works as designed)

Please file a patch against file_entity module to fix the bug there. Hiding this with an array_filter() is just suppressing a valid error.

bryancasler’s picture

Project: Entity cache » File Entity (fieldable files)
Version: 7.x-1.x-dev » 7.x-2.x-dev
Priority: Normal » Minor
Status: Closed (works as designed) » Active

This was against x 7.x-1.1, but I can't select that anymore.

dave reid’s picture

I believe this would have been fixed by #2132383: Warning: array_flip(): Can only flip STRING and INTEGER values! .. DrupalDefaultEntityController->load() (.. 176 .. entity.inc). already. If you are still getting this on the most recent release, then please re-open.

Status: Closed (duplicate) » Needs review

The last submitted patch, 3: entitycache-filterids-1508612-3.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 4: entitycache-filterids-1508612-4.patch, failed testing.