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
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | after_patch.png | 44.39 KB | larisse |
| #4 | before_patch.png | 53.02 KB | larisse |
Issue fork jsonapi_image_styles-3229545
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 #4
larisse commentedI apply the patch in merge request #2 and the error was removed. But I'm find a new error #3229668: ParseError: syntax error, unexpected 'EntityTypeManagerInterface' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in Symfony\Component\ClassLoader\ApcClassLoader->loadClass() (line 21 of modules/contrib/jsonapi_image_styles/src/Form/JsonApi and is necessary apply the patch to install the module in Drupal 8.9.16 version.
Comment #5
isaacrc commentedI 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!
Comment #6
wellsHi, 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+.
Comment #7
wellsActually, 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.
Comment #8
lamp5So why this version of module is compatible with drupal 8?
Comment #9
wellsThat’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.
Comment #11
wells