After upgrading to 7.x-1.0-beta10, I ran into the following error when saving any content that used a content type that had the field_collection type utilized.

Warning: array_filter() expects parameter 1 to be array, string given in field_collection_item_is_empty()

The server for the website I noticed the issue on is using PHP 5.6 (also is running on Windows Server if that makes any difference). For right now I reverted to the prior versions code for that particular block and it seems to be working as expected.

Even with the error, it didn't see to cause any issues with saving and updating the data though, from what I could see.

CommentFileSizeAuthor
#3 field-collection-2599248-2.patch605 bytesdonutdan4114
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ShawnCollier created an issue. See original summary.

donutdan4114’s picture

The issue is in field_collection.module:591....
$all_boolean = $instances && !(bool) array_filter('_field_collection_field_is_not_boolean');
Should actually be:
$all_boolean = $instances && !(bool) array_filter($instances, '_field_collection_field_is_not_boolean');

donutdan4114’s picture

Patch attached.

donutdan4114’s picture

Status: Active » Needs review

  • donutdan4114 authored ec024e5 on 7.x-1.x
    Issue #2599248 by donutdan4114: array_filter() issue after upgrading to...
jmuzz’s picture

Status: Needs review » Fixed

Thanks for the correction!

Mistah7’s picture

Thanks for quick reply!

thfalvar’s picture

Thanks you for your rapidity

timme77’s picture

Thanks!

joshuautley’s picture

Thank you.

computerbarry’s picture

Just ran into this issue.
Patch works great and fixed everything :)

Thanks!

caw67’s picture

patch works for me

joachim’s picture

Does this maybe warrant a new beta release?

computerbarry’s picture

Does this maybe warrant a new beta release?

I think that is a good idea.

Barry

raprieto’s picture

#3 worked for me also. Thank you donutdan4114

dfish17’s picture

Yikes, I just tried to apply this patch manually and am getting the following error. I tried to do a full restore of home directory and database and am still getting the error. What did I do wrong?

Parse error: syntax error, unexpected end of file in /home/karenl12/public_html/sites/all/modules/field_collection/field_collection.module on line 1510

derherrberger’s picture

#3 fixed the issue for me.
Thank you donutdan4114!

amaisano’s picture

@dfish17 - try disabling the module (manually in the DB > system table if you have to). Kind of sounds like a rogue quote mark somewhere in the code. You may need to manually clear the caches in the DB too.

NikLP’s picture

This appeared to work for me for a day or so, but the problem recurred today. I've re-applied the patch but I get a slew of errors identical to those mentioned when I save anything with a _collection on it. :/

i15’s picture

Can you please make a new version 7.x-1.0-beta11 with path?
Please :)
Thank you!

jimmynash’s picture

Patch in #3 worked for me.

vensires’s picture

Version: 7.x-1.0-beta10 » 7.x-1.x-dev

This issue is actually fixed in 7.x-1.x-dev only and not in 7.x-1.0-beta10.
By they way, patch in #3 also worked for me.

jens78’s picture

Thanks for the patch!

Didier Misson’s picture

Patch #3 is OK.
Thanks.

JurriaanRoelofs’s picture

A new beta release would be great, then I dont have to hack my product to pin beta9 in the build scripts.

timme77’s picture

Status: Fixed » Closed (fixed)
Amad Tababa’s picture

Updating to the latest dev sort the issue for me.

Thanks

func0der’s picture

Can we please have a new release of this immediately? With this bug the module is unusable in "stable" state.

mulderjoe’s picture

Thank you for the patch #3, seems to work well. I have beta10, and it seems the patch fix was not included in that beta.

xturgorex’s picture

Thanks for the patch. #3 worked.

boinx2516’s picture

Thanks! Patch on #3 worked well.

Andre-B’s picture

this commit requires a new release. module is unusable without it.

yugi’s picture

Patch #3 works well. A new beta release would be great, it is not really stable with this issue in it.

edward.peters’s picture

I am having the same problem. A fresh release asap would be highly appreciated! Thanks for all the work.

dolcaer’s picture

Has this been released yet? If not, is it advisable to manually install this patch now, or wait a bit longer?

vensires’s picture

Feel free to use the patch to patch the stable version on your installation or use the -dev version.

mrupsidown’s picture

Please release a new version asap.

joshuautley’s picture

For those looking for a new release:

Typically, modules receive multiple "patches" before a new release is created.

If you do not know how to apply a patch... A patch is simply new code showing which line items are to be deleted and added. Advanced developers can apply patche's programmatically.

I'm guessing those requesting a new release are not "advanced developers" and in an attempt to assist you please read how to apply patches manually > https://www.drupal.org/node/534548.

I hope this helps.

Andre-B’s picture

why the rant? the issue is plain simple, the latest release does not work anymore and will require a lot admins to apply this patch manually. For me it doesn't matter that much to do that, for others it does, and since field_collection is used by 125k+ installations with a variety of knowledge, releasing a hot fix for this is the least that can be done. rather than pointing them to a manual in the issue queue to apply a patch themselves.

joshuautley’s picture

I'm not ranting, I'm trying to help. I am not the maintainer. I'm simply a fellow community member.

I understand your point. Please don't misunderstand mine.

Andre-B’s picture

sorry for that, I must have misread your comment.

mrupsidown’s picture

I know how to apply a patch and #3 works... still I think this should be released in a new version asap.

computerbarry’s picture

Look on the bright side, we have a patch :)
The maintainer could be busy, frustrating I know, at least things work now.

For anybody not familiar applying patches, like myself, still only use patches to change the code manually.

Check out my reply for a user who wanted to update this module with this current patch.

A single line of code is all that needs changing.
www.drupal.org/node/2607968

Barry

vensires’s picture

Well, this patch isn't something so difficult to apply manually. For anyone not familiar with patches or scared of all this terminology, just...

  1. Open the field_collection.module file in your favorite text editor
  2. Go to line 592
  3. Replace array_filter('_field_collection_field_is_not_boolean'); with array_filter($instances, '_field_collection_field_is_not_boolean');
  4. Save the file back
glynster’s picture

Confirmed patch resolves the issue.

glynster’s picture

+1 RTBC

maxplus’s picture

Hi,
thanks, patch #3 solves this issue for me:
"error Warning: array_filter() expects parameter 1 to be array, string given in field_collection_item_is_empty() (line 591"

mengi’s picture

patch #3 solved it for me.

deggertsen’s picture

It would be nice to have a new release that includes this patch. Thanks for the fix!

maximpodorov’s picture

+1 for the new release!

ssoulless’s picture

Please commit this, and add it to the new stable release.

Richard15’s picture

patch #3 solved it for me.

belaustegui’s picture

The patch is working perfectly.
+1 for the new release.

ladybug_3777’s picture

patch in #3 works for me as well.

Another vote for the new release PLEASE!!!!

Anonymous’s picture

+1 for a new release which includes this. Even if the module is technically still a beta, it is so heavily used that it really shouldn't come with such easily-seen error messages, given that a patch to fix it has already been created.

baltazarz3’s picture

Thanks guys, the patch saved my life during a live deployment. You rock

Yoran Scholiers’s picture

I'll be just another +1. Patch #3 works.

Toraih’s picture

+1 ! Patch should be moved to the stable release long ago...

madelyncruz’s picture

Patch #3 worked for me too. Thank you.

mlanning’s picture

Patch #3 worked for me as well. Thank you.

DrCord’s picture

This solved my problem! Thanks.

knalstaaf’s picture

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

I believe this was set on "closed" too early. I guess this should be regarded as RTBC.

jmuzz’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the feedback all.

I released 7.x-1.0-beta11 with this fix.

ladybug_3777’s picture

Slightly unrelated, but I'm curious... the Field Collection module has existed since 2010 (I went back and looked through the commit history). It's been almost SIX years of life and it's still considered a beta? This module seems to be widely used and has decent support... why has it never officially moved out of the beta stage??

Status: Fixed » Closed (fixed)

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

jmuzz’s picture

Path to stable 1.0 release: https://www.drupal.org/node/1821320

Also see: https://www.drupal.org/node/2339023

Summary: It doesn't support all core features yet. There are still problems with revision support and content translation in particular.

shobhit_juyal’s picture

#3 worked for me. Thanks for the patch.