ModuleHandler error after upgrading Hook Event Dispatcher

Created on 4 November 2022, about 2 years ago
Updated 14 March 2023, almost 2 years ago

Problem/Motivation

After upgrading hook_event_dispatcher to newest version mail_safety dashboard gives error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 3 passed to Drupal\mail_safety\Form\DashboardForm::__construct() must be an instance of Drupal\Core\Extension\ModuleHandler, instance of Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /web/modules/contrib/mail_safety/src/Form/DashboardForm.php on line 65 in Drupal\mail_safety\Form\DashboardForm->__construct() (line 52 of modules/contrib/mail_safety/src/Form/DashboardForm.php).
Drupal\mail_safety\Form\DashboardForm->__construct(Object, Object, Object) (Line: 65)
Drupal\mail_safety\Form\DashboardForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\mail_safety\Form\DashboardForm') (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\mail_safety\Form\DashboardForm') (Line: 58)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 159)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
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: 270)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 226)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Install latest versions hook_event_dispatcher & mail_safety
  • go to mail safety dashboard

Proposed resolution

This happens because hook_event_dispatcher introduced a decorated moduleHandler. Mail Safety should type-hint ModuleHandlerInterface rather than a specific implementation

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇧🇪Belgium Den Tweed

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024