Recent changes to migrate_tools can break migrations rely on hook_migration_plugins_alter()

Created on 11 September 2025, 11 days ago

Problem/Motivation

Recent changes made to Drupal\migrate_tools\MigrationPluginManager::processDefinition() as part of πŸ“Œ Move source_module and destination_module from Migrate to Migrate Drupal Needs work caused a regression for sites using migration plugins with source plugin definitions that are added via hook_migration_plugins_alter() implementations, e.g. through shared configuration defined in a migrate_plus migration group.

The new code added to Drupal\migrate_tools\MigrationPluginManager::processDefinition() assumes that source plugin IDs will already exist in migration plugin definitions (and does not sufficiently check that they do exist). This is not always the case because modules can alter migration plugin definitions via hook_migration_plugins_alter() and Drupal\Core\Plugin\DefaultPluginManager:: findDefinitions() doesn't apply alter hook implementations on plugin definitions until after processing each definition with ::processDefinition().

This change causes migration operations involving these migrations to fail with PHP warnings like these:

Warning: Undefined array key "plugin" in Drupal\migrate_drupal\MigrationPluginManager->processDefinition() (line 90 of core/modules/migrate_drupal/src/MigrationPluginManager.php).

Drupal\migrate_drupal\MigrationPluginManager->processDefinition() (Line: 257)
Drupal\migrate\Plugin\MigrationPluginManager->findDefinitions() (Line: 216)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 146)
Drupal\migrate\Plugin\MigrationPluginManager->expandPluginIds() (Line: 114)
Drupal\migrate\Plugin\MigrationPluginManager->createInstances() (Line: 93)
Drupal\migrate\Plugin\MigrationPluginManager->createInstance() (Line: 124)

Steps to reproduce

  • Install migrate_drupal module on a site that contains migrations plugins that rely on alterations to their plugin definitions (e.g. a migration plugin derived from a migrate_plus migration configuration entity that uses shared config from a migration group).
  • Try performing migration operations

Proposed resolution

Add some sanity checking code to the recent additions made to Drupal\migrate_tools\MigrationPluginManager::processDefinition() to make it less fragile.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

migration system

Created by

πŸ‡ΊπŸ‡ΈUnited States joegraduate Arizona, USA

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

Merge Requests

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