Error: Cannot use object of type Closure as array in Drupal\migrate_tools\MigrateExecutable->resetListeners()

Created on 14 September 2023, over 1 year ago
Updated 16 October 2023, about 1 year ago

Problem/Motivation

Executing migration fails with PHP error Cannot use object of type Closure as array in Drupal\migrate_tools\MigrateExecutable->resetListeners() (line 294 of /var/www/html/web/modules/contrib/migrate_tools/src/MigrateExecutable.php)

foreach ($this->getEventDispatcher()->getListeners($event_name) as $registered_listener) {
  if ($registered_listener[0] instanceof self) {
    $this->getEventDispatcher()->removeListener($event_name, $registered_listener);
  }
}

getListeners returns array<callable[]|callable>, so $registered_listener will not always be an array.

Steps to reproduce

To be listed

Proposed resolution

I added an additional check to make sure $registered_listener is an array

Remaining tasks

🐛 Bug report
Status

Needs review

Version

6.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024