Fixed
Project:
PhotoSwipe - Responsive JavaScript Modal Image Gallery
Version:
5.0.14
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
19 Nov 2026 at 16:04 UTC
Updated:
19 Nov 2026 at 16:20 UTC
Jump to comment: Most recent
Comments
Comment #2
anybodyIt's a regression from #3605632: Replace "photoswipe.drush.inc" with a native Drupal 11 "DrushCommands" class
I'll prepare a fix and add a test!
Comment #3
anybodyMy fault, I didn't review carefully enough. -.-
Comment #4
anybodyConfirmed. Drush 12+ auto-discovers command classes in
src/Drush/Commands/and only injects dependencies through a staticcreate()factory. Without one, it falls back tonew $class()(seeDrush\Runtime\ServiceManager::instantiateServices()), which fails becausePhotoswipeCommands::__construct()requires two arguments. The error is only logged at debug level. The command kept working because the deprecateddrush.services.ymlregistered it a second time.Pushed to the issue fork (
3639469-could-not-instantiate):PhotoswipeCommandsnow usesDrush\Commands\AutowireTrait. Both constructor types (GuzzleHttp\ClientInterface,Drupal\Core\File\FileSystemInterface) have service aliases in core, so no explicit wiring is needed.drush.services.yml.PhotoswipeCommandsTest::testCommandCanBeInstantiatedByDrush(), which builds the command viacreate()the way Drush does. It fails without the fix and passes with it.Note:
AutowireTraitrequires Drush 12.5+. If older Drush 12 releases must be supported, a hand-writtencreate()would work instead.Still needed: an MR from the issue branch, and a manual check with
drush photoswipe:install-plugin(anddrush list -vvvto confirm the debug message is gone).AI disclaimer: This analysis, fix and test were created with the help of AI (Claude Code) and reviewed by me.
Comment #7
grevil commentedComment #8
grevil commented