Use LoggerChannelFactoryInterface

Created on 26 April 2023, almost 2 years ago
Updated 28 April 2023, almost 2 years ago

Problem/Motivation

Other modules, such as Redirect 404 module ( https://www.drupal.org/project/redirect ) , may implement their own LoggerChannelFactory and override Core. If Redirect 404 module is enabled, the following error will occur when attempting to use Klaro :

TypeError: Drupal\klaro\Utility\KlaroHelper::__construct(): Argument #7 ($logger) must be of type Drupal\Core\Logger\LoggerChannelFactory, Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\klaro\Utility\KlaroHelper->__construct() (line 103 of modules/contrib/klaro/src/Utility/KlaroHelper.php).

Proposed resolution

This happens because other modules, such as Redirect 404 in your case, may implement their own LoggerChannelFactory and override core's. Using LoggerChannelFactoryInterface instead of LoggerChannelFactory will fix this!

Remaining tasks

Review my patch

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium hezounay

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

Comments & Activities

Production build 0.71.5 2024