Hi..
i give it a try..but i get a huge error with entityCache Module enabled...i dont know is it entityCache module bug or FileField Sources...

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (Zeile 54 von ./all/modules/entitycache/entitycache.module).
the error appers 20 times on the frontpage...i know a similar bug with entityCache module and pagetitle pls look here http://drupal.org/node/1109106

one other error after enable is this
Fehlermeldung
Notice: Undefined index: filefield_sources in filefield_sources_field_process() (Zeile 132 von ./sites/all/modules/filefield_sources/filefield_sources.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eule’s picture

Title: Undefined index + entityCacheLoad » Undefined index + entityCacheLoad + DrupalDefaultEntityController

hi again a bug track

i disable Entity cache 7.x-1.0-rc2 this brings me this error 20 times

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

NoDice’s picture

Ditto. I get same warning:

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

It seems to appear when you go to a content type, manage fields, and click edit on an image field (not seeing warning with File fields) (e.g. admin/structure/types/manage/CONTENT-TYPE/fields/field_IMAGE_FIELD).

BTW, I'm not using entity cache. And some had said this issue was related to Page Title and was fixed with dev version (see #1018280: Warning: array_flip() entity.inc) - but I'm using Page Title 7.x-2.x-dev (Feb. 25th).

This warning started appearing immediately after enabling FileField Sources 7.x-1.2-beta1 and 7.x-1.3

eule’s picture

hi
i make a filed with it...just deinstall the module dont´fix the error..u need to del the field..the error is gone..phuu
i need to shoot down my site...i can´t fix the error...what you do ? is fixed after deinstall ? i use too pagetitle 7.x-2.x-dev

quicksketch’s picture

Hi guys, any ideas on if this can be reproduced with just FileField Sources on a clean install? I'm not sure how entity cache or page title would have any effect on FileField Sources.

l33tdawg’s picture

I don't have Entity Cache and get this error when viewing articles that don't already have an image already attached:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/drupal7/includes/entity.inc)

l33tdawg’s picture

On the main / front page, I get one Warning per article that doesn't already have an image attached...

quicksketch’s picture

Title: Undefined index + entityCacheLoad + DrupalDefaultEntityController » Warning: array_flip() in entityCacheLoad and DrupalDefaultEntityController
Status: Active » Postponed (maintainer needs more info)

Hi guys, again I'd really like to see this done from a clean install. By most accounts on drupal.org this is caused by calling entity_load() without an integer value. FileField Sources doesn't contain a single call to entity_load(), comment_load, taxonomy_term_load(), node_load(), or other entities. It does contain a few calls to file_load() though, but only when saving a new file with a few sources. It never makes any loading calls upon display, nor really, does it save anything into the database at all other than a few Field module settings. FileField Sources is merely a tool for setting File ID values on file fields.

Note: Let's put the undefined index problem in a separate issue.

NoDice’s picture

Status: Postponed (maintainer needs more info) » Active

I reproduced with a clean D7 install and FileField Sources 1.3.

1.) Go to manage fields for Basic Page and add new Image field. (not sure if it does the
2.) Create basic page content without uploading an image field and promote to front page (not sure if this step is necessary)
3.) Enable FileField Sources 1.3
4.) Go back to manage fields for basic page and click "Edit" for the Image field
5.) Click the "File Sources" drop down and check "File attach from server directory" (because by default, nothing is checked for File Sources)
6.) Save settings
7.) Now click on Edit again for the Image field and warning should appear at top
8.) Also, go back to front page and notice the warning appearing on every refresh above our content we published to front page

NOTE: I'm not getting the warning when I repeat the steps using a File field - only the Image field.

quicksketch’s picture

Thanks NoDice, looks like you're right. Huh. Well this is going to take some looking into. Thanks for the update.

quicksketch’s picture

Status: Active » Fixed
FileSize
8.06 KB

So, the root of the problem is that FileField Sources is inadvertently removing the "Default image" option at the very bottom of the image field configuration form. When the settings are saved, an incorrect value for the default image is saved into the field settings. Then whenever the default image is supposed to be displayed, image.module calls file_load() on an array('fid' => 0). It shouldn't actually call file load at all, because it should start with the value of "0" (instead of an array).

The solution is rather simple though, we just need to restore that default image field. Since FileField Sources doesn't (yet) know how to handle managed_file elements that aren't on entity forms, it's supposed to bail out. Unfortunately it accidentally takes the entire field with it. This patch makes it so that the field is unaffected by FileField Sources.

To solve the issue for all existing fields (after applying this patch or waiting for 1.4), just edit the field and re-save the settings. I'll probably be putting out a 1.4 release shortly.

quicksketch’s picture

Sorry that patch had a lot of unrelated cruft. This fix is only a one line change.

NoDice’s picture

Status: Fixed » Active

Confirmed patch in #11 works - warning messages are removed.

Thanks quicksketch for your speedy fix - everyone appreciates your hard work.

NoDice’s picture

Status: Active » Fixed
joakimekroos’s picture

Thanks for speedy bugfixing.

RowboTony’s picture

Hi, I'm not an uber-geek debugger, but this array_flip error just showed up on my fresh site, and I also tracked it down to the same as mentioned in post #8. I created an image field in a node, then later enabled filefield_sources, saved a node without uploading an image, then the array_flip error pops up. I applied the patch, but I had to edit and resave that image field in the node content type / manage fields before the error disappeared. So, the patch works, thank you!

l33tdawg’s picture

The patch definitely works (though you'll need to go into Structure->Content Types->Manage Fields) and re save the image field (you don't need to change any settings, just click edit and save).

plastikkposen’s picture

Same problem I had: http://drupal.org/node/1140370
Patch and re-save fields seems to work. :-)

quicksketch’s picture

The 1.4 release includes this fix.

Status: Fixed » Closed (fixed)

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

Jawi’s picture

Same issue here. Will give #17 a try.