I am using this module as part of the panopoly distribution. After updating this recently from 1.47 to 1.49, which updated file_entity from 2.0-beta3 to 2.12, I started to get a lot of these warnings:

Warning: Invalid argument supplied for foreach() in file_entity_set_title_alt_properties_on_file_fields() (line 245 of /srv/www/html/build/html/profiles/panopoly/modules/contrib/file_entity/file_entity.file.inc).

In my case, this is related to a solr document entity that is handled by Sarnia, so I'm not entirely sure where this should be fixed.

The warning is created because file_entity tries to loop through the field items, assuming that each item is an array. In the case of solr documents created by the Sarnia module, this doesn't seem to be the case for all items.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

berliner created an issue. See original summary.

berliner’s picture

The attached patch removes the warnings in my setup.

As I said, I'm not sure where this should be fixed, but I can't see a functional problem with this patch and it removes the warnings.

rblackmore’s picture

berliner's patch removed the warnings in my dev environment (mysql 5.5.57 / PHP 5.6.31). My testing was very brief, but after applying the patch there were no obvious problems with Sarnia, Media or Media WYSIWYG: Search results still return and media uploads still work.

joseph.olstad’s picture

ok, we're planning a new release of file_entity very soon (in the next 7 days) , I'll have a closer look at the patch soon, consider it for the upcomming release.

joseph.olstad’s picture

joseph.olstad’s picture

I'm a bit unsure of this change, it's not clear to me if items are always expected to be arrays , I'm a bit apprehensive about committing this and then having a regression in some other situation so I'm going to postpone it until 7.x-2.15.

please upgrade to 7.x-2.14 and re-apply this patch if you still need it.

joseph.olstad’s picture

This could be added to 2.16 but I'd appreciate a few test examples to help review.

GarChris’s picture

Patch worked for me. Just a note: make sure you are using the latest stable version (7.x-2.15) or patch may not apply correctly. Thanks Berliner

muckermarc’s picture

Works for me too, file_entity 7.x-2.15 and sarnia 7.x-1.13. Thanks!