Hi guys,
Just noticed a stack of warnings coming up at admin/structure/file-types/manage/image/file-display/*
Starting with this one:
Warning: array_keys() expects parameter 1 to be array, null given in bg_image_formatter_field_formatter_settings_form() (line 40 of /home/website/htdocs/drupal/sites/all/modules/bg_image_formatter/bg_image_formatter.module).
Then continuing on to a bunch of invalid argument supplied complaints like this one:
Warning: Invalid argument supplied for foreach() in bg_image_formatter_field_formatter_settings_form() (line 44 of /home/website/htdocs/drupal/sites/all/modules/bg_image_formatter/bg_image_formatter.module).
Any idea what needs to change here? I did a queue search for "bg_image_formatter_field_formatter_settings" but did not hit anything...
We are using the WYSIWYG module, and I have just installed the entity_view_modes module. No other changes to the site. Not sure if this warning has been there all along or if it has just appeared.
Thanks for any advice or guidance.
Comment | File | Size | Author |
---|---|---|---|
#14 | bg_image_formatter-null-entity-type-values-2354563-13.patch | 638 bytes | Xtal |
Comments
Comment #1
PolHello,
Unable to reproduce the bug here, sorry.
Comment #2
BrightBoldHmm. I'm now getting this error too, although I was not earlier. I also use Entity View Modes, but I am using CKEditor module instead of WYSIWYG. I'll try to look back through the git logs and see how recently Entity View Modes was installed as that may be the common thread.
Comment #3
BrightBoldUnfortunately I can't figure out when I installed Entity View Modes. I disabled it but the error persisted. Then I also disabled Media WYSIWYG View Modes so that only core view modes would remain, but that didn't clear up the error. There's a non-core view mode showing, "preview," but I don't know what module creates that. (Media?)
The line in the code that's throwing the error is
foreach ($entity_types as $entity_type) {
where$entity_types = array_keys($field['bundles']);
. So it's clearly an entity-related problem of some sort. But I don't know where it's gettingarray_keys($field['bundles'])
from, so I'm at my limit on troubleshooting here.Comment #4
Xtal CreditAttribution: Xtal commentedI have made a patch for this (the stable release) which adds empty() clauses around the lines in question.
This is my first patch submitted to the community so I would appreciate some feedback on it.
Thanks!
Comment #5
PolHi,
Thanks for your patch!
Here's a quick review
Could you please use !empty instead of this ?
Same here
Comment #6
Xtal CreditAttribution: Xtal commentedUpdated, Thanks!
Comment #7
Xtal CreditAttribution: Xtal commentedComment #8
PolUnable to apply the patch.
I suggest you to read: https://www.drupal.org/node/707484
Comment #9
Xtal CreditAttribution: Xtal commentedCheers pol, will do!
Comment #10
Xtal CreditAttribution: Xtal commentedComment #11
PolHello,
The patch is applying successfully, however, here's my review:
$entity_types is not declared before. Is this condition really needed ?
The same condition is used 4 lines before. Is this really necessary ?
Comment #12
Xtal CreditAttribution: Xtal commentedApologies, that's a mistake. Here is a new patch.
Thanks
Comment #13
PolThese are exactly the same patch as before, you just changed the spaces.
Please see my remarks in my previous comment.
Comment #14
Xtal CreditAttribution: Xtal commentedPatch 8 and 11 do differ, 8 had an unwanted if statement in it.
Regarding your comment #11,
The way I see it there are two points where the code depends on $entity_types having a value.
There were 2 errors showing for me which where null value warning.
Attached is the patch with just the first check for the $entity_type not being empty.
Thanks
Comment #15
Xtal CreditAttribution: Xtal commentedComment #16
PolYou're right about the patches, sorry.
Now I'm reviewing your patch but there's still something that I don't understand.
When I look at the code of the module at line 83, you see:
It's the first time that the variable
$entity_types
gets declared.What's the use of your patch then ?
Your patch try to replace that line with:
Is your patch really necessary ?
$entity_types
will always be empty before line 83 and will never be prepopulated because it's not used before anywhere else.Could you explain me please ?
Comment #17
Xtal CreditAttribution: Xtal commentedIt's a bug that appears with display suite when setting the files display with a view mode.
It's only when Display suite view modes are used with file display settings.
Comment #18
PolI'm sorry but I'm unable to reproduce the bug here.
Could you tell me the minimum step to do to reproduce it please so I can fix the bug properly ?
Thanks.
Comment #19
Xtal CreditAttribution: Xtal commentedOk maybe it's too specific.
I saw this bug by the following modules being enabled...
- display suite
- entity view modes
and then trying to configure an image display at admin/structure/file-types/manage/image/file-display
Im happy to leave this issue closed but should i create a sandbox project to recreate the error ?
Thanks
Comment #20
PolNo need of a sandbox, don't worry.
I will first try to recreate the bug here and report here my findings.
Comment #22
PolI just pushed a fix, could you tell me if it's ok ?
Thanks.
Comment #23
Xtal CreditAttribution: Xtal commentedHi Pol thanks, this has solved the error.
I appreciate your help with my first patch!
Comment #24
PolYou're welcome.
Comment #25
Xtal CreditAttribution: Xtal commentedPlease can you credit me for this patch.
Thanks
Comment #26
PolSorry, it will be for the next time.
Keep in mind that I credit people when:
Comment #27
Xtal CreditAttribution: Xtal commentedNo attribute
Comment #28
PolSorry ?
Comment #29
Xtal CreditAttribution: Xtal commentedForget it, no worries pol
Comment #31
Xtal CreditAttribution: Xtal at NDP commented