Problem/Motivation

Not using the LoggerChannelFactoryInterface interface

This will result on errors with another module is trying to pass the logger Channel Factory
like the Redirect 404 module.

The website encountered an unexpected error. Please try again later.
TypeError: Argument 5 passed to Drupal\campaign_kit\Campaign\CampaignService::__construct() must be an instance of Drupal\Core\Logger\LoggerChannelFactory, instance of Drupal\redirect_404\Render\Redirect404LogSuppressor given

Steps to reproduce

Given that the "Redirect 404" and "Campaign Kit" modules were installed in the same Drupal 9 site
When navigating to any Campaign kit's routes
Then the following fatal error will show up

The website encountered an unexpected error. Please try again later.
TypeError: Argument 5 passed to Drupal\campaign_kit\Campaign\CampaignService::__construct() must be an instance of Drupal\Core\Logger\LoggerChannelFactory, instance of Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/html/dev/drupal9campaign_kit/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\campaign_kit\Campaign\CampaignService->__construct() (line 120 of modules/contrib/campaign_kit/src/Campaign/CampaignService.php).
Drupal\campaign_kit\Campaign\CampaignService->__construct(Object, Object, Object, Object, Object, Object, Object, Object) (Line: 262)
Drupal\Component\DependencyInjection\Container->createService(Array, 'campaign_kit.campaign_service') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('campaign_kit.campaign_service') (Line: 47)
Drupal\campaign_kit\Form\ConfigurationForm::create(Object) (Line: 28)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\Drupal\campaign_kit\Form\ConfigurationForm') (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject(Object, '\Drupal\campaign_kit\Form\ConfigurationForm') (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: 578)
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: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->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: 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: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Replace class LoggerChannelFactory with the interface LoggerChannelFactoryInterface

Remaining tasks

  • Fix
  • Test
  • Automated testing
  • Review
  • Commit
  • Release

User interface changes

  • None

API changes

  • None

Data model changes

  • None
CommentFileSizeAuthor
#2 3232107-2.patch4.46 KBrajab natshah

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

StatusFileSize
new4.46 KB
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes