Problem/Motivation
When updating a Drupal 10 site to the newest version of the module (5.0.11), opening pages where photoswipe is active produces a fatal error, and a WSOD. This is at least partially caused by usage of a class that is not present in Drupal 10 and lower.
One example is the usage of the "ImageDerivativeUtilities" class in src/Plugin/Field/FieldFormatter/PhotoswipeFieldFormatter.php. This class does not exist in Drupal 10 and lower.
Steps to reproduce
Install Photoswipe 5.0.11 on a Drupal 10 site, use it on a field, and open the page.
Proposed resolution
As a temporary fix, downgrade to Photoswipe 5.0.10 and fix the version in composer (composer require 'drupal/photoswipe:5.0.10), or do not upgrade from 5.0.10
Thanks,
Mark.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | photoswipe--d10-compat-image-derivative-utilities.patch | 2.35 KB | nicodh |
Issue fork photoswipe-3629506
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nicodh commentedI attach a patch that fixes this issue (use ImageDerivativeUtilities::styleOptions() if present D11+, image_style_options() if not).
Comment #3
nicodh commentedComment #4
apotek commentedWe just ran into this issue too. Site whitescreened. Minor patch version updates really shouldn't drop compatibility with a Drupal version.
Thank you @nicodh for the patch.
Comment #5
steveoriolThe patch works for me.
Comment #6
anybodyPlease prepare this as MR, we'll merge it then, once tests go green.
Comment #7
anybodyComment #9
grevil commentedThanks for this great information!
Comment #11
grevil commentedPlease review
Comment #12
anybodyComment #14
anybodyComment #16
anybody@grevil:
Please see #3623808: You have requested a non-existent service "Drupal\image\ImageDerivativeUtilities". - is that approach superior or is it good enough like this?
Anyway I wonder why our tests didn't catch this! We should add one to see this in the future, before breaking things!
Comment #17
grevil commented@anybody it is basically the same outcome, but generally speaking, the DeprecationHelper is code wise cleaner yea.
But not really worth changing again IMO. Although the tests started to fail after rebase?
Comment #18
grevil commentedOk, all green in dev!