Hello,
i get the error on my sites mostly when i have a taxonomie without content.

•Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 54 of .sites/all/modules/entitycache/entitycache.module).
•Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of ./includes/entity.inc).

Comments

catch’s picture

This happens if something other than an array of IDs gets passed to entity_load(), and it's the same error for core as entitycache, and is usually down to bad data.

Could you put file_put_contents('/tmp/backtrace.txt', print_r(debug_backtrace()), FILE_APPEND); just above line 54, hit that page, then upload that file to this issue?

Also are you using any modules other than core?

eule’s picture

hi
jep some other modules: agrcache,entity
please correct me if i wrong

$passed_ids = !empty($ids) ? array_flip($ids) : FALSE;
('/tmp/backtrace.txt', print_r(debug_backtrace()), FILE_APPEND);

sorry i don´t have programming knowledge:
Parse error: syntax error, unexpected ',' in ./sites/all/modules/entitycache/entitycache.module on line 55

EDIT:
and english as well..i put it now above but same
Parse error: syntax error, unexpected ',' in ./modules/entitycache/entitycache.module on line 54

eule’s picture

StatusFileSize
new48.95 KB

sorry sorry i´m so stupid

i put this now above file_put_contents('/tmp/backtrace.txt', print_r(debug_backtrace()), FILE_APPEND);
its prints a huge txt on the site but can´t find /tmp/backtrace.txt is this for the root or module folder?
anyway i paste and save it

tebb’s picture

Title: entityCacheLoad array-flip warning near line 54 » entityCacheLoad line 54

@catch

I'm getting the same (line 53 not 54?) warning, but it feels random so far.
I'm switching between https and http a bit in case that is relevant.
Will put the trace file statement in and upload if I catch it again.

@eule:

The trace file should be in the /tmp directory.
If you have a command line, you should be able to do this:

cd /tmp
ls -l backtrace.txt
cat backtrace.txt

The last command will list the file to your screen.
(Sorry if you already know all this.)

tebb’s picture

Title: entityCacheLoad line 54 » entityCacheLoad array-flip warning near line 54

Had a similar issue, so will add the backtrace to line 177 in entity.inc, with a different file name.

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /pathToD7/includes/entity.inc).
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /pathToD7/includes/entity.inc).

tebb’s picture

Possibly a newbie error on my part, but I can't see the cause.

I'm getting the backtrace output to the screen and only a line of 1's in the file.

The only difference between my code and the suggestion in #1 is the filename.

file_put_contents('/tmp/backtrace.txt', print_r(debug_backtrace()), FILE_APPEND);

file_put_contents('/tmp/backtrace.entitycache.module.txt', print_r(debug_backtrace()), FILE_APPEND);

tebb’s picture

I've changed from:
file_put_contents('/tmp/backtrace.txt', print_r(debug_backtrace()), FILE_APPEND);
to:
file_put_contents('/tmp/backtrace.txt', print_r(debug_backtrace(), TRUE), FILE_APPEND);

Now I have a 13Mb file from a Warning at line 184 in entity.inc.
Shall I attach it to this entitycache issue or create one for entity?

I'm just trying to edit out the sitename, domain info and zip it.

tebb’s picture

Title: entityCacheLoad line 54 » entityCacheLoad array-flip warning near line 54

I *can* recreate the error in #5 by going to any other page after visiting /user.

The same happens for http and https.

Most (all?) of the issues (entity, entity cache, entity token) disappear if I disable the Page Title module.

@eule: Do you have the Page Title module enabled?

catch’s picture

Could you try disabling entitycache, but making no other changes, and see if you still get the error.

If you do, then this has nothing to do with entitycache.

eule’s picture

Hi
sorry for reading this a bit late..some cache issue i mean

@Dru-p yep i have page title enabled 7.x-2.4-beta1 and thanks for the tip with the command line..but i´m not a pro and not using in drush..want to learn ;)

catch’s picture

Project: Entity cache » Page Title
Version: 7.x-1.x-dev » 7.x-2.x-dev

Since you both have page title installed, and Dru-p said the error went away if it was disabled, I'm going to move this issue over there.

eule’s picture

thanks guys

tebb’s picture

OK, I did some testing enabling and disabling modules.

Initially the issue looks to be in entity cache:
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheBaseController->load() (line 53 of /pathToD7/sites/all/modules/entitycache/entitycache.module).

Disabling entitiy cache moves the issue to entity.inc
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /pathToD7/includes/entity.inc).

Then disabling Page Title removes the issue.

I guess this is what you would expect.

catch’s picture

Yep, that means it's at least not an issue with entitycache (or the core entity.inc).

andypost’s picture

subcribe

steven jones’s picture

Assigned: Unassigned » steven jones

The arguments to user_load changed in D6 -> D7 patch is on its way...

steven jones’s picture

Assigned: steven jones » Unassigned
Status: Active » Needs review
StatusFileSize
new724 bytes
new732 bytes

Patch attached fixes the issue.

Long-term you should not use the arg function though, menu_get_object is the way forward!

andypost’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Sure, user_load() accepts $UID as parameter

nicholasthompson’s picture

Status: Reviewed & tested by the community » Closed (fixed)

This is fixed in 7.x-2.x-dev. You can see here that the user.page_title.inc file uses menu_get_item instead now.

http://drupalcode.org/project/page_title.git/blob/refs/heads/7.x-2.x:/mo...

Cheers guys,
Nick