Migrate "findMigrationDependencies" function throws error when "process" param is null

Created on 26 June 2018, about 7 years ago
Updated 17 July 2025, about 1 month ago

Problem/Motivation

(Why the issue was filed, steps to reproduce the problem, etc.)

I created a module to migrate data in JSON Format from an external source with the help of the migrate plus module .
When running a migrate command via drush, like:

drush migrate-status import_data --verbose

the following error is shown:

TypeError: Argument 1 passed to Drupal\migrate\Plugin\Migration::getProcessNormalized() must be of the type array, null given, called in /xxx/xx/xxx/xxx/core/modules/migrate/src/Plugin/Migration.php on line 634 in Drupal\migrate\Plugin\Migration->getProcessNormalized() (line 391 of /xxx/xxx/xxx/xxx/core/modules/migrate/src/Plugin/Migration.php) #0 /xxx/xxx/xxx/xxx/core/modules/migrate/src/Plugin/Migration.php(634): Drupal\migrate\Plugin\Migration->getProcessNormalized(NULL)

If i set the variable $process inside the function Drupal\migrate\Plugin\Migration::getProcessNormalized() to an empty array (line 633), all the drush migrate commands work and i can migrate my data:

  protected function findMigrationDependencies($process) {
    $return = [];
    $process = array();
    foreach ($this->getProcessNormalized($process) as $process_pipeline) {
      foreach ($process_pipeline as $plugin_configuration) {
        if (in_array($plugin_configuration['plugin'], ['migration', 'migration_lookup'], TRUE)) {
          $return = array_merge($return, (array) $plugin_configuration['migration']);
        }
        if (in_array($plugin_configuration['plugin'], ['iterator', 'sub_process'], TRUE)) {
          $return = array_merge($return, $this->findMigrationDependencies($plugin_configuration['process']));
        }
      }
    }
    return $return;
  }

Proposed resolution

(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)

Make sure that even the $process param is an array() as default instead of null

🐛 Bug report
Status

Closed: works as designed

Version

8.8 ⚰️

Component

migration system

Created by

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

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