Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
file.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Oct 2010 at 00:11 UTC
Updated:
11 Nov 2011 at 19:13 UTC
Jump to comment: Most recent file
Comments
Comment #1
furamag commentedPlease provide the screenshot of error page. I have added image field to page content type without any errors.
Comment #2
ebremer commentedAttached
bug1.jpg - what it looks like looking at a sample about page
bug2.jpg - what i added
bug3.jpg - click save and error starts showing. Removing the field clears the error.
Comment #3
Shiny commentedstill happening in beta3
Error message
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 167 of /home/brenda/projects/drupal/seven/includes/entity.inc).
Comment #4
robhamm commentedThis doesn't seem to be just an image issue. Another way to reproduce is to go to your "my account" page, then click on a "home" link. Screen shot attached.
* Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 167 of /home/robhamm/public_html/main/includes/entity.inc).
* Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 343 of /home/robhamm/public_html/main/includes/entity.inc).
Comment #5
ebremer commentedComment #6
juves commentedI recive this Warning if I go to 'My Account' and then reload this page or go anywhere else
I recive this Warning immediately, if i go to 'user/username/edit'
RC1
Comment #7
juves commentedComment #8
amirtaiar commentedI am getting the same error - what is that and what can I do?
Comment #9
Jamie Holly commentedI can confirm this issue. What's happening is file_load_multiple() is getting passed $fids. Each item in $fids actually contains an array:
That is then passed eventually to DrupalEntityControllerInterface->load, which is where the error occurs.
The temp (and ugly) fix I put in right now was to extract the $fids into a new array in file_load_multiple():
I've bumped the priority to major given the popularity of file fields and can confirm it also exists in RC2. Not sure if my fix is the best route for it. I just don't know that much about the new fields engine in D7. I just traced back far enough to get a temp fix in. Not really sure if this is an issue in the file system or image.
**Edit - I just noticed that this only occurs if there is no image selected. If you have an image then this is not called. It doesn't depend on the required checkbox.
Comment #10
ebremer commentedThis seems to be working for me now in RC3.
Comment #11
nihonsei commentedIn Drupal 7.0 - rc3, getting this warning.
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of includes/entity.inc).
Comment #12
droplet commentedWhat system os, php version.
seems to be ok in Dev. version.
Comment #13
nihonsei commentedGetting above warning after log in to site (Just after "Session opened for admin").
OS: Linux; PHP: 5.2.14
My site (http://indojp.com) is hosted on Bluehost.com.
Comment #14
ddorian commentedplease check with latest dev
droplet says no errors in latest dev
set to active if error still shows in the latest dev
Comment #15
Jamie Holly commentedStill getting the error:
This is on PHP 5.2.14 and still occurs if you have an image field with no image. As soon as you add an image it goes away.
Comment #16
catchMoving to file module for now.
Comment #17
ebremer commentedFor reasons of testing, I removed the one image I had and the problem returned even in RC3. However, like #15 intoxination, the error goes away once you add an image.
Comment #18
Jamie Holly commentedDigging further into this, here's what I am finding. In image_field_prepare_view(), it attempts to load the default image:
file_load() should take an array of fids, but this is what's being passed to it:
The error also pops up on the image field settings page and is from image_field_settings_form():
I don't even get the default image settings to show on the page, so something appears to be going on in managed_file.
Comment #19
Jamie Holly commentedOK I dug deeper. I did a new install from head and everything works fine. I then checked on a site that was built starting with RC2 and the problem persists, so the problem appears to be fixed, but if you are upgrading it still exists. Perhaps we need an upgrade path to roll in the fix?
Comment #20
nihonsei commentedI also did a new install (7.x-Dev), but getting same warning twice at the time of login.
Comment #21
R2-D8 commentedAfter testing some 7.x-modules i went flushing all caches;
afterwards i wanted to set the site back online on the maintenance page.
There i got those errors:
After refreshing the page the error was gone.
UPDATE
On the imce-tab at the user screen ( user/1/imce ) those errors persist.
Comment #22
Greg Adams commentedOK I'm having the same problem on a new install of drupal 7.0.
I am getting errors here and there. (too many for my taste)
(Little OFF TOPIC)
I installed TAO and Rubik theme (needed to modify Rubik to work correctly).
Funny thing is.. I got an error after I uploaded the SKY theme (not even activated) so I deleted that immediately. (those were different errors than this one)
I guess Drupal 7 and it's modules/themes are not really ready for public as it is supposed to.
NO OFENCE...(I know how hard people worked on this) but this is definitely not making my work easier.
What I normally do in about 3-4 hours has taken me 2 days (2 days like in 30 hours - 2 days) so far and was all for nothing.
Just saying that it might have been a little early for a drupal 7 release.
I will be working with Drupal 6.20 on the next few websites I'll be making.
What I found out:
The problem occurs when I install the "Page-Title" module.
Comment #23
finex commentedI confirm that the problem occurs after enabling "page title" module. (using Drupal 7.0)
Comment #24
ebremer commentedanother problem. I created a new node type, but this time, I made the image field use a private download. The above problem still occurs, goes away when you actually upload an image, but then a new error is added on saving of the node:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'image_style_generate' was given in menu_execute_active_handler() (line 501 of /www/drupal-7.0/includes/menu.inc).
It goes away if I remove the uploaded cck image, but, then the original error comes back. - E
PS - This being on Drupal 7.0
Comment #25
marcvangendRe #19: I believe you're right, I had the same problem on a site that started with a beta version. The error was reported three times on my home page: once for every file or image field. The problem went away after updating to Drupal 7.0 and re-saving one of the image field settings (http://example.com/admin/structure/types/manage/[contenttype]/fields/[fi...). It's not really an upgrade path but I hope that helps anyone.
Comment #26
ecksley commentedDisabling Page Title module (on D7) fixed this problem for me as well. Thanks for the tip.
Comment #27
gc11 commentedDisabling the Page Title module has fixed most of the error messages i had been receiving, including when setting up test users. Thanks for that.
Comment #28
ebremer commentedI just did a fresh install of Drupal 7.0 and the problem still persists.
I get this error now when I enter the "Image styles" area (I have two custom image styles created):
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'image_style_generate' was given in menu_execute_active_handler() (line 501 of /www/ebremer-7.0/includes/menu.inc).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'image_style_generate' was given in menu_execute_active_handler() (line 501 of /www/ebremer-7.0/includes/menu.inc).
Comment #29
catchAre you sure that was a fresh install with a clean database? image_style_generate() doesn't exist as a function in Drupal 7 any more, and is only mentioned in a code comment. If it's a new install, do you have contributed modules installed?
I can't reproduce this locally, but I did get these errors on http://d7.7/node#overlay=admin/config/media/image-styles/edit/thumbnail
So we're definitely missing some test coverage.
Comment #30
Jamie Holly commentedI finally tracked down what was causing the issue on my side to being an issue with the insert module. See:
http://drupal.org/node/850946
Comment #31
ebremer commentedYes, a clean database, and I think intoxination may have found it. I did turn on insert after the db wipe. My bad. The problem persists though even after the insert module is removed. But it does disappear when you delete the previously "Insert" enabled fields then re-add them.
Comment #32
Jamie Holly commentedActually you don't need to delete the fields, just go to the screen for each field and resave them. It appears it's something with information the insert module is saving into the field info.
I'm just wondering if there aren't other modules that could also be causing this problem for other people. Perhaps there was an API change in the field stuff along the lines and the contrib modules aren't caught up yet.
Comment #33
catchMarking this as duplicate of #850946: Warning after enabling Insert: Warning: array_flip(): Can only flip STRING and INTEGER values!. I opened #1020870: theme_image_style_preview() and image_requirements() should check whether style directories are writable for the notices.
Comment #34
AbdullahR commentedpage_title model show me this error when I move from user profile to home page through site logo
Comment #35
lammertsm commentedPage Title 7.x-2.4-beta1 Module causing the issue on my site.
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /includes/entity.inc).
* Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 354 of /includes/entity.inc).
Comment #36
dave reid@AbdullahR @lammertsm: Then go to the page_title issue queue! This was already fixed with #1018280: Warning: array_flip() entity.inc in page_title.
Comment #37
mrgoltra commentedsub. Trying to figure this one out.
Comment #38
Dabitch commentedSub. Getting "Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178" with any version of token (patched, not patched, old patched, latest dev) now hunting elsewhere. Testing on an 6.20 -> D7 upgrade.
Comment #40
bhorsa commentedsub. getting the error when I log in with a test account to create content. Only appears when first moving away from home page after log-in. Does not reappear until re authentication.
Comment #41
francisrmd commentedDisabling Image module cleared this problem for me in Drupal 7.x.
Comment #42
SchwebDesign commentedsubscribing. Here's what my error looks like:
I believe the first time i got this was after installing the video module and adding an image and video field to the same content type.
Comment #43
spessex commentedDisabling Page Title module (on D7) fixed this problem for me as well.
Comment #44
zincdesign commentedDisabling Page Title module has fixed the problem for me.
Comment #45
shortspoken commented#42 solved the problem for me. Had a video and image field at the same content type. Deleted the video field and the error message was gone...
Comment #46
rade commentedI got the same error when trying to use file_load_multiple() in my own module.
The problem occurred when I used field_get_items() to fetch all items of a certain field in a node and then pass the value of that as entity IDs to file_load_multiple().
My original code, which caused the error:
This is what array $items looks like now:
The fix was to store only the IDs in a new array:
Now the array $ids looks like this:
Hope this helps!
//Rade
Comment #47
sayansk commentedI think that is very close to solving the mystery ... Maybe someone have a specific solution?
Comment #48
adamgerthel commentedI've got this error on a D7.7 install on an image field on a term. The message appears when trying to add a new term.
Comment #49
bmango commentedI started getting this error message when I included a default picture for user profiles and then created a view of new users with their photo. I configured the view as a block, and any pages which showed this view got the error message. Removing the photo from the view fixed the problem, and the error message disappeared.
Comment #50
jwilson3I started getting this error when I made a call to
taxonomy_term_load_multiple($items)in a custom module.The list of $items being passed in has the following structure:
Notably, in this case, even though the warning message is thrown, the function call itself does return a valid list of fully loaded taxonomy terms.
So two things:
1) this issue is not limited to image/file modules only, but rather a deeper core bug with the *_load_multiple() not properly handling the variety of input that implementing modules could be using.
2) something is inconsistent in that implementing module (taxonomy in this case) works fine with array of arrays type structures, but the entity module/controller/whatever does not.
Comment #51
drecute commentedI'm getting this error in hook_block_configure of a custom module. I'm providing a form for managed_file upload and this error pops up just when the #element_validate callback is called.
This thread at SO makes a case for all
*_loadoverrides.In my implementation, I do not have a reference of *_load but I'm sure the error started at the call of uec_request_prospectus_block_image_validate. Also not sure if
file_save_upload()could be the cause.Comment #52
Pimmy commentedI get this error with D7.9 when a result from a search is returned and only when logged in as authenticated user.
Comment #54
IronWorker commentedsee: http://drupal.org/node/1102570