- Issue created by @natefollmer
- Assigned to nivethitha
- Status changed to Closed: works as designed
almost 2 years ago 8:50am 23 January 2023 - 🇮🇳India nivethitha
In drupal 7, If you select the Access by Role settings, then you must select the atlease one role on view otherwise it gives an issue when you apply/save the changes on view itself. If you maintain the view properly, then it won't give any issue on view migrate from drupal 7 to drupal 9 using "Views Migrate" module.
- 🇺🇸United States natefollmer
Right, but if the role that has access is deleted, then the View remains and so does the Role Access setting. We can't always trust that users will maintain the View properly as that's how I found this issue :)
At the bare minimum, I think we should at least throw an error and not import the View. This causes errors that are hard to track down. I don't mind creating a patch, I just wanted some input from others on how they thought we should best handle this before I did the work.
- Issue was unassigned.
- Status changed to Active
over 1 year ago 5:12am 5 May 2023 - 🇸🇪Sweden arne_hortell
Please, can a patch be created?
To use it is optional but i think i need it. - 🇸🇪Sweden arne_hortell
Here is my situation
Argument #3 ($bt) must be of type string, null given, called in modules/contrib/views_migration/src/Plugin/migrate/source/d7/ViewsMigration.php on line 238 in modules/contrib/views_migration/src/Plugin/migrate/source/d7/ViewsMigration.php on line 256 #0 modules/contrib/views_migration/src/Plugin/migrate/source/d7/ViewsMigration.php(238): Drupal\views_migration\Plugin\migrate\source\d7\ViewsMigration->convertFieldFormatters(Array, 'file', NULL)
#1 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php(419): Drupal\views_migration\Plugin\migrate\source\d7\ViewsMigration->prepareRow(Object(Drupal\migrate\Row))
#2 [internal function]: Drupal\migrate\Plugin\migrate\source\SourcePluginBase->next()
#3 core/modules/migrate/src/MigrateExecutable.php(292): FilterIterator->next()
#4 /vendor/drush/drush/includes/drush.inc(122): Drupal\migrate\MigrateExecutable->import()
#5 vendor/drush/drush/includes/drush.inc(113): drush_call_user_func_array(Array, Array)
#6 modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(953): drush_op(Array)
#7 modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(413): Drupal\migrate_tools\Commands\MigrateToolsCommands->executeMigration(Object(Drupal\migrate\Plugin\Migration), 'upgrade_d7_view...', Array)
#8 [internal function]: Drupal\migrate_tools\Commands\MigrateToolsCommands->import('upgrade_d7_view...', Array)
#9 vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#10 vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run(Array)
#20 vendor/drush/drush/drush(4): require('/var/www/fleet....')
#21 {main}
TypeError: Drupal\views_migration\Plugin\migrate\source\d7\ViewsMigration::convertFieldFormatters(): Argument #3 ($bt) must be of type string, null given, called in modules/contrib/views_migration/src/Plugin/migrate/source/d7/ViewsMigration.php on line 238 in Drupal\views_migration\Plugin\migrate\source\d7\ViewsMigration->convertFieldFormatters() (line 256 of modules/contrib/views_migration/src/Plugin/migrate/source/d7/ViewsMigration.php). - 🇳🇿New Zealand petednz
concur this is causing problems, even for new views created on the site after the migration. i don't (yet) understand how to identify the View with the 'deleted role' issue - especially as it is still not obvious to me that any roles have been deleted on the d7 site (it lists the same roles as it used to have on the d6 version of the site if i am reading the migrate_map_d7_user_role and migrate_map_d6_user_role tables correctly
can anyone offer a 'this is out to workaround this issue' suggestion. am happy to delete any offending view in d10 - just can't figure which is the problem one (or several)
To find a view where there is role access but no role set, you can export the entire config (/admin/config/development/configuration/full/export -> Full archive -> Export), unzip and run a command like this:
find . -type f -print | grep views.view | xargs grep " role"
This prints all the instances of the text ' role' in the views, and should hopefully narrow down which views might be causing the problem.In our case, the broken value of role was
role: '': null
, so searching for '': null might be faster, although I'm not sure that '': null will always be the value of role.
If it is, this command will find which files have the broken roles, and need to be fixed:
find . -type f -print | grep views.view | xargs grep "'': null"