I'm encountering a similar error but in a different scenario:
Error: Call to a member function getValue() on array in animated_gif_preprocess_image_formatter()
Anyway I think the solution for the error in the issue description would also solve that error I found. As for the patch in #14, I think that this won't be sufficient and is lacking a basic validation of whatever is inside
$variables['item']
is actually an object or even is set at all. So maybe something likeif (empty($variables['item']) || $variables['item'] instanceof \Drupal\image\Plugin\Field\FieldType\ImageItem) { return; }
would solve the error described in the IS as well as the one I'm encountering.
In my case, the steps to replicate this are the following (it includes other contribs, so not sure if it's a great example):
On Vanilla Drupal 9.5.x
- $ drush si -y && drush en -y admin_toolbar_tools, media, component_library, media_library && drush uli
- Add a media reference field to the article content type and make sure it's using the Media Library widget on the node form
- Create an article node adding an image media in the media field
- Enable the animated_gif module
- Refer to the following screencast for further steps
- Status changed to Needs work
almost 2 years ago 1:46am 2 March 2023 - Status changed to Needs review
almost 2 years ago 11:27am 31 March 2023 - last update
over 1 year ago Composer require failure - Status changed to Postponed: needs info
over 1 year ago 7:31pm 23 April 2023 - 🇫🇷France Grimreaper France 🇫🇷
Hi,
I tried to reproduce from the steps provided in comment 17.
No problem. I tried with image field, image field with entity browser, media field.
In this gif screencast you will see my entity browser view configuration.
- 🇪🇸Spain jansete
I remember that for me I could reproduce with fields that have multiple fields, maybe entity reference with multiple images in the field, because in xdebug y showed an entitties array instead a single entity, for me the last patch worked
- 🇳🇱Netherlands Ruuds
See the attached patch for a version which works with the 2.x branch.
- last update
about 1 year ago 2 pass - last update
about 1 year ago 2 pass - Assigned to Grimreaper
- Status changed to Needs work
7 days ago 2:36pm 8 January 2025 - 🇫🇷France Grimreaper France 🇫🇷
I had been able to get the issue with Layout Builder preview.
When displaying a media entity reference field with the "Thumbnail" formatter.
- Merge request !17Issue #3056477 by ruuds, acbramley, uridrupal, jansete, sebastix, grimreaper,... → (Open) created by Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
I think the problem is deeper and not necessarily related to animated_gif.
Because once there is no more fatal error, I still have plenty of warnings from Core codebase, so I guess there is an alteration somewhere that "destroys" expected input data.