- Issue created by @johnnydarkko
- πΊπΈUnited States mglaman WI, USA
Looks like a bug in animated_gif_preprocess_image_formatter
That module's preprocess hook is crashing the page. It's trying to load the file with it's null ID.
- πΊπΈUnited States mglaman WI, USA
Yeah - https://git.drupalcode.org/project/animated_gif/-/blob/2.0.x/animated_gi...
They're not accessing the file via the `entity` property and trying to re-load it. And this module mocks all data.
- Status changed to Needs review
about 1 year ago 11:06pm 8 November 2023 - last update
about 1 year ago Composer require failure - πΊπΈUnited States johnnydarkko
Patched the 8.x-1.x module to skip the image formatter preprocess hook if `$imageValues['target_id']` doesn't exist.
- πΊπΈUnited States mglaman WI, USA
Why skip? The file object exists as the entity property on the field
- last update
about 1 year ago 2 pass - πΊπΈUnited States johnnydarkko
Ah! Sorry! Here's a patch that uses the entity in the array instead of reloading the file entity.
- πΊπΈUnited States mglaman WI, USA
Sweet! This should make the code more resilient. I haven't manually tested but it gets my +1 as it's using a better approach.
Technically the file wasn't reloaded because of static cache in the entity storage. But now it's using the entity value from properties ensuring it's the correct entity object the field is working with
- last update
about 1 year ago 2 pass - πΊπΈUnited States johnnydarkko
Thank you mglaman! I had to set up a fallback just in case the entity isn't in the array because I started getting this warning when applying the patch from #8:
Warning: Undefined array key "entity" in /app/web/modules/contrib/animated_gif/animated_gif.module on line 20
If there is no entity object in the array, fallback to load the entity via the `target_id` key.
- Assigned to Grimreaper
- π«π·France Grimreaper France π«π·
Hi,
Thanks for the patch. I can reproduce the problem with Views remote data and the fix is quite simple so I will merge it without tests.
What I can't figure out is why in the case of Views Remote Data there is this "entity" key in $imageValues that is provided and why it is not present all the time.
Fixing PHPCS Fixer and PHPStan by the occasion.
- last update
12 months ago 2 pass -
Grimreaper β
committed 2d7a2bac on 2.0.x authored by
johnnydarkko β
Issue #3398875 by johnnydarkko, mglaman: PHP Error when using mock file...
-
Grimreaper β
committed 2d7a2bac on 2.0.x authored by
johnnydarkko β
-
Grimreaper β
committed dff55371 on 2.0.x
Issue #3398875 by Grimreaper: Fix PHPCS Fixer and PHPStan.
-
Grimreaper β
committed dff55371 on 2.0.x
- Issue was unassigned.
- Status changed to Fixed
12 months ago 5:45pm 25 November 2023 - πΊπΈUnited States mglaman WI, USA
It's not set because it's computed. Calling getValue takes literal values without calculating computer ones, like the entity adapter value.
Switching to property accessors would fix it
Automatically closed - issue fixed for 2 weeks with no activity.