I was created the slider in my project. The slider images were created using field collection module.whenever I edit the slider image it show the following warning message.

(Warning: array_filter() expects parameter 1 to be array, string given in field_collection_item_is_empty() (line 591 of /var/www/html/multisite/docroot/sites/all/modules/contrib/field_collection/field_collection.module)).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jabastin.ameex created an issue. See original summary.

RobertInOP’s picture

We had received the same warning error in a similar use of 7.x-1.0-beta10. Making this change on line 591:

- $all_boolean = $instances && !(bool) array_filter('_field_collection_field_is_not_boolean');
+ $all_boolean = is_array($instances) && !((bool) array_filter($instances, '_field_collection_field_is_not_boolean'));

seems to have solved the issue. Give it a try.

brunoric’s picture

Created a very simple patch for the array_filter problem.

diff --git a/field_collection.module b/field_collection.module
index 1dd651f..8ddcbc5 100644
--- a/field_collection.module
+++ b/field_collection.module
@@ -598,7 +598,7 @@ function field_collection_item_is_empty(FieldCollectionItemEntity $item) {
   $is_empty = TRUE;

   // Check whether all fields are booleans.
-  $all_boolean = $instances && !(bool) array_filter('_field_collection_field_is_not_boolean');
+  $all_boolean = $instances && !(bool) array_filter($instances, '_field_collection_field_is_not_boolean');

   foreach ($instances as $instance) {
     $field_name = $instance['field_name'];
brunoric’s picture

Adding relative patch.

bkat’s picture

#4 works for me.

MegaChriz’s picture

Status: Needs work » Closed (duplicate)
ybabel’s picture

#4 worked for me