Not compatible with D8, <D9.1; EventDispatcher::dispatch()

Created on 16 November 2023, 8 months ago
Updated 15 December 2023, 7 months ago

Problem/Motivation

Changes to the EventDispatcher::dispatch() argument order meant this module is not compatible with older Drupal core versions less than 9.1.

Triggering the ED when running Drupal Core <9.1 will cause the following error:

TypeError: Argument 2 passed to Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch() must be an instance of Symfony\Component\EventDispatcher\Event or null, string given, called in /app/web/modules/contrib/commerce_stock/modules/local_storage/src/StockLocationStorage.php on line 32 in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 89 of core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php)
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>

For those still stuck on D8, https://git.drupalcode.org/project/commerce_stock/-/merge_requests/16.diff

Old ED::dispatch() ordering

$this->eventDispatcher->dispatch(LocalStockEvents::FILTER_STOCK_LOCATIONS, $event);

Proposed resolution

Update core_version_requirement: ^9.1 || ^10

Remove core key as this was only for Drupal core <8.7.7

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India shobhit_juyal New Delhi

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024