Problem/Motivation

Migration appears to be broken in 1.0-rc9.

Steps to reproduce

Install 1.0-rc9 and attempt migration via Drush on Drupal 8.9.13.

Expected: usable migration

Result:

Cannot use string offset as an array in web/modules/contrib/inline_entity_form/src/MigrationHelper.php on line 53 #0 web/modules/contrib/inline_entity_form/inline_entity_form.module(465): Drupal\inline_entity_form\MigrationHelper->alterPlugins(Array)

Attempt to run drush migrate-upgrade --configure-only or drush migrate-import fail with above error.

Unsure of solution. Meantime have rolled back to rc8 via composer.

CommentFileSizeAuthor
#7 3208818-7.patch823 bytesjunaidpv
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dfletcher created an issue. See original summary.

geek-merlin’s picture

Title: Migration support in 1.0-rc9 » Migration Error: Cannot use string offset as an array in MigrationHelper.php on line 53
Version: 8.x-1.0-rc9 » 8.x-1.x-dev

aram.gevorgyan made their first commit to this issue’s fork.

aram.gevorgyan’s picture

I also have this issue after upgrading module.

volker23’s picture

Same here. Drupal 9.2.9, 8.x-1.0-rc9

3cwebdev’s picture

Same issue as above. Had to uninstall inline_entity_form to allow migration to work. The migration's content type didn't use any inline_entity_form displays either so the issue is outside of that.

junaidpv’s picture

StatusFileSize
new823 bytes

I am using this patch to work around the error.

xurizaemon’s picture

Status: Active » Needs review

Testing this alongside #3226253: hook_migration_plugins_alter is instantiating all source plugins and it seems to fix the fatal error we were seeing on drush migrate:status.

geek-merlin’s picture

sjhuskey’s picture

The patch in #7 worked for me on Drupal 9.4.1. Thank you @junaidpv!

geek-merlin’s picture

Status: Needs review » Postponed (maintainer needs more info)

Too many migration issues, many of which look overlapping or duplicate.
Postponing on parent issue.

anybody’s picture

Closed #3208631: d7_entity_location_field_widget.yml syntax breaks migrations with inline_entity_form as duplicate of this issue, as this one already has a patch and is more detailed on the same point.

anybody’s picture

Status: Postponed (maintainer needs more info) » Needs review

Based on the parent issue, I can now clearly say, that this is a separate issue and fixes a clear bug where an array is expected, but might not be one or not even existing in specific migrations.

Patch #7 fixes the issue. I created a MR and changed the implementation a bit:

// Ensure the map exists and is an array:
if (!empty($migration['process']['options/type']['type']['map']) && is_array($migration['process']['options/type']['type']['map'])) {
  $map_addition = [
    'inline_entity_form_single' => 'inline_entity_form_simple',
    'inline_entity_form' => 'inline_entity_form_complex',
  ];
  $migration['process']['options/type']['type']['map'] = array_merge($migration['process']['options/type']['type']['map'], $map_addition);
}
  1. Now using !empty() instead of isset() which I think is safer and faster here.
  2. And defining the variable in the if clause with a unique name, as it is not related to the $addition variable in the lines above.

Tested this successfully, so this is ready for review and NOT related to any of the other migration issues / siblings!

grevil’s picture

LGTM! The described changes make sense to me!

geek-merlin’s picture

Status: Needs review » Needs work

Thorough cleanup work, much appreciated! Also MR is appreciated a lot.

MR is "not currently mergeable" though.

grevil’s picture

Status: Needs work » Needs review

Done Rebasing! Should be ready to commit! Please review. :)

grevil’s picture

@Anybody yes, the changes were not part of the patch but part of your refactoring you mentioned in #13. ;)

anybody’s picture

Sorry @Grevil, you are right, as it seems this change already came in with my MR... while I don't really know how that happened. Crazy. Anyway I don't think that change is correct. I reverted that line now. Please review again.

anybody’s picture

The 2 failing tests seem BTW unrelated to me:

PHP Fatal error: Uncaught Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in /var/www/html/core/lib/Drupal.php:169

grevil’s picture

Status: Needs review » Reviewed & tested by the community

Tests are green now and changes make sense!

Currently testing the diff for a custom d7 to d9 Migration. :)

geek-merlin’s picture

> Currently testing the diff for a custom d7 to d9 Migration. :)

So i wait for feedback on this.

grevil’s picture

Currently testing the diff for a custom d7 to d9 Migration

Sorry for not replying earlier! Works like a charm. :)

  • geek-merlin committed 06c60e0 on 8.x-1.x authored by Anybody
    Issue #3208818 by Anybody, Grevil, aram.gevorgyan, junaidpv, geek-merlin...
geek-merlin’s picture

Status: Reviewed & tested by the community » Fixed

🎵 Another one bites the dust...!🎵
Thanks to all, especially Grevil and Anybody for finally nailing this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.