Fast404EventSubscriber incorrect parameter(s) for onKernelRequest() and onNotFoundException() methods

Created on 29 June 2023, over 1 year ago
Updated 18 August 2023, over 1 year ago

Problem/Motivation

We recently updated our composer.json for this module from ^2.0@alpha to ^3.0@alpha.

After the upgrade the following errors started appearing:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\fast404\EventSubscriber\Fast404EventSubscriber::onKernelRequest() must be an instance of Symfony\Component\HttpKernel\Event\RequestEvent, instance of Symfony\Component\HttpKernel\Event\GetResponseEvent given in Drupal\fast404\EventSubscriber\Fast404EventSubscriber->onKernelRequest() (line 50 of modules/contrib/fast_404/src/EventSubscriber/Fast404EventSubscriber.php).
Drupal\fast404\EventSubscriber\Fast404EventSubscriber->onKernelRequest(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object) (Line: 127)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 265)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 132)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\fast404\EventSubscriber\Fast404EventSubscriber::onNotFoundException() must be an instance of Symfony\Component\HttpKernel\Event\ExceptionEvent, instance of Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent given in Drupal\fast404\EventSubscriber\Fast404EventSubscriber->onNotFoundException() (line 73 of modules/contrib/fast_404/src/EventSubscriber/Fast404EventSubscriber.php).
Drupal\fast404\EventSubscriber\Fast404EventSubscriber->onNotFoundException(Object, 'kernel.exception', Object)
call_user_func(Array, Object, 'kernel.exception', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exception', Object) (Line: 227)
Symfony\Component\HttpKernel\HttpKernel->handleException(Object, Object, 1) (Line: 79)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 265)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 132)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

  1. Update onKernelRequest method's $event parameter to be \Symfony\Component\HttpKernel\Event\GetResponseEvent and update onNotFoundException method's $event parameter to be \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
πŸ’¬ Support request
Status

Fixed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrobison

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024