Undefined array key "inspections" and "source_operations"

Created on 25 October 2023, about 1 year ago
Updated 17 December 2023, 11 months ago

Problem/Motivation

Before version 8.x-2.7 having no inspections key under an operation: get_field entry, or no source_operations key under the top level migration_tools key would not prevent a migration from running. Since 2.7 these conditions result in the following warnings:

Warning: Undefined array key "inspections" in Drupal\migration_tools\Operations::process() (line 116 of /var/www/web/modules/contrib/migration_tools/src/Operations.php)

and

Warning: Undefined array key "source_operations" in Drupal\migration_tools\Operations::process() (line 73 of /var/www/web/modules/contrib/migration_tools/src/Operations.php)

respectively. The migrations then fail.

Steps to reproduce

Make a migration_tools migration with no source_operations key.

Make a migration_tools migration with no inspections key inside an operation: get_field.

Proposed resolution

Gracefully handle these missing array keys.

We have addressed this for now by adding source_operations: null and inspections: { } where needed.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.7

Component

Code

Created by

🇺🇸United States msielski

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

Comments & Activities

  • Issue created by @msielski
  • Assigned to mohd sahzad
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India mohd sahzad

    I have updated this issue in attached patch1 please review.

  • 🇺🇸United States swirt Florida

    Thank you @msielski for reporting this issue. Thank you @Mohd_Sahzad for the rapid patch.

    @msielski can you test this patch out and see if it solves the issue?

    • swirt committed f25bc486 on 8.x-2.x
      Issue #3396729 by Mohd Sahzad, msielski, swirt: Undefined array key "...
  • Status changed to Fixed 11 months ago
  • 🇺🇸United States swirt Florida

    Thanks @Mohd Sahzad for the patch and @msielski for reporting it.

    I altered the patch a bit to use the more modern null coalesce operator.

  • 🇺🇸United States swirt Florida

    Also for note, The 'source_operations' key was resolved by this, but I could not find

    Warning: Undefined array key "inspections" in Drupal\migration_tools\Operations::process() (line 116 of /var/www/web/modules/contrib/migration_tools/src/Operations.php)
    

    Line 116 or anything near it contained anything about inspections.
    nor could I find "inspections" as a key anywhere in the codebase.

  • Status changed to Fixed 11 months ago
  • 🇺🇸United States swirt Florida

    Goes out with 2.8

Production build 0.71.5 2024