Problem/Motivation

During migration I am seeing this as other people are reporting on the original migration issue #3253034: Migration from D7 to D9

[warning] Undefined array key 1 MailSystemModules.php:28
[warning] String offset cast occurred MailSystemModules.php:36
Error: Cannot use string offset as an array in /var/www/html/public/modules/contrib/mailsystem/src/Plugin/migrate/process/MailSystemModules.php on line 36 #0 /var/www/html/public/core/modules/migrate/src/MigrateExecutable.php(453): Drupal\mailsystem\Plugin\migrate\process\MailSystemModules->transform(Array, Object(Drupal\migrate_tools\MigrateExecutable), Object(Drupal\migrate\Row), 'modules')
#1 /var/www/html/public/core/modules/migrate/src/MigrateExecutable.php(221): Drupal\migrate\MigrateExecutable->processPipeline(Object(Drupal\migrate\Row), 'modules', Array, Array)
#2 /var/www/html/vendor/drush/drush/includes/drush.inc(62): Drupal\migrate\MigrateExecutable->import()
#3 /var/www/html/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array(Array, Array)
#4 /var/www/html/public/modules/contrib/migrate_tools/src/Drush/Commands/MigrateToolsCommands.php(1072): drush_op(Array)
#5 /var/www/html/public/modules/contrib/migrate_tools/src/Drush/Commands/MigrateToolsCommands.php(483): Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands->executeMigration(Object(Drupal\migrate\Plugin\Migration), 'mycs_mail_syste...', Array)
#6 [internal function]: Drupal\migrate_tools\Drush\Commands\MigrateToolsCommands->import('mycs_mail_syste...', Array)
#7 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#8 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#18 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#19 /var/www/html/vendor/bin/drush(119): include('/var/www/html/v...')
#20 {main}
Error: Cannot use string offset as an array in Drupal\mailsystem\Plugin\migrate\process\MailSystemModules->transform() (line 36 of /var/www/html/public/modules/contrib/mailsystem/src/Plugin/migrate/process/MailSystemModules.php).
[warning] Drush command terminated abnormally.

Steps to reproduce

drush mim mail_system_settings

Proposed resolution

TBD

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 Screenshot 2024-07-22 at 16.49.52.png503.94 KBjoelpittet

Issue fork mailsystem-3463222

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

joelpittet created an issue. See original summary.

joelpittet’s picture

StatusFileSize
new503.94 KB

I am not sure I have a good solution for this. My guess is to skip it when there is no key.
Here's the xdebug session
xdebug

joelpittet’s picture

Status: Active » Needs review

This fixes the error but again I echo Berdir in that this migration might be better to manually do.

berdir made their first commit to this issue’s fork.

  • berdir committed f41dbd7d on 8.x-4.x authored by joelpittet
    Issue #3463222 by joelpittet: Error: Cannot use string offset as an...
berdir’s picture

Status: Needs review » Fixed

Yes, maybe I shouldn't have merged this. The changes that this actually results in useful configuration are very slim.

But, tests still pass (now that I rebased on top of the test fixes that I did) and it seems to help, so merged.

Status: Fixed » Closed (fixed)

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