Problem/Motivation

Upon installation of the new 2.0.0 version of the module, the following error that breaks the Drupal site:

NOTICE: PHP message: TypeError: Argument 1 passed to Drupal\jsonapi_image_styles\EventSubscriber\ConfigSubscriber::onResponse() must be an instance of Symfony\Component\HttpKernel\Event\ResponseEvent, instance of Symfony\Component\HttpKernel\Event\FilterResponseEvent given in /var/www/web/modules/contrib/jsonapi_image_styles/src/EventSubscriber/ConfigSubscriber.php on line 32 #0 [internal function]: Drupal\jsonapi_image_styles\EventSubscriber\ConfigSubscriber->onResponse()
#1 /var/www/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#2 /var/www/vendor/symfony/http-kernel/HttpKernel.php(191): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#3 /var/www/vendor/symfony/http-kernel/HttpKernel.php(173): Symfony\Component\HttpKernel\HttpKernel->filterResponse()
#4 /var/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#5 /var/www/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#6 /var/www/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#7 /var/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#8 /var/www/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#9 /var/www/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#10 /var/www/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#11 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#12 /var/www/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#13 /var/www/web/index.php(19): Drupal\Core\DrupalKernel->handle()

Steps to reproduce

Fresh install of Drupal v.8.9.18.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 after_patch.png44.39 KBlarisse
#4 before_patch.png53.02 KBlarisse
Command icon 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

shallee created an issue. See original summary.

bsains made their first commit to this issue’s fork.

isaacrc’s picture

I can reproduce the issue with Drupal core 8.9.19 and JSON:API Image Styles version 2.0.0 and I can confirm that the patch solved the problem. Thanks!

wells’s picture

Status: Reviewed & tested by the community » Needs work

Hi, all -- `FilterResponseEvent` is deprecated in Drupal 9 (see #3094398: Update Symfony response and request events to new classes) so I'd rather avoid this. I think there is some way to handle both possibilities (without having separate branches for 8 and 9) but I can't seem to dig up a solution for that. One way or another we'll need a solution that doesn't use the deprecated class in Drupal 9+.

wells’s picture

Status: Needs work » Closed (won't fix)

Actually, given Drupal 8 EOL is coming up here in about a month (see PSA-2021-2021-06-29) I'm going to close this. Those needing ongoing Drupal 8 support can use the patch here or I will consider a merge for a compelling case and updated MR that supports both Drupal 8 and 9 easily.

lamp5’s picture

So why this version of module is compatible with drupal 8?

wells’s picture

Status: Closed (won't fix) » Reviewed & tested by the community

That’s fair. The pre-releases for 2.x were already supporting D8 and 9 when I took this module over. It would make sense I guess to merge this in to 2.x and make a new 3.x release for D9+ at this point.

Moving back to RTBC and will follow up on this soon.

  • wells committed a40ffb1 on 2.0.x authored by bsains
    Issue #3229545 by bsains, larisse, shallee, lamp5, isaacrc: TypeError:...
wells’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.