First time using drupalmoduleupgrader and can't get it run. Tried with my custom module, as well as feeds and another one I can't remember. I did all the updates as per the README, no change. I also updated drush. That turned out to a mistake as now drush fails too.

Results are always the same. Just after the 'indexing ...' line it fails with

exception 'InvalidArgumentException' with message '$string ("") must be a string.' in /opt/sites/md81/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145

Sorry, I can't provide more detail, it has rolled off screen and I can't rerun until I can get drush running.

Comments

quietone created an issue. See original summary.

quietone’s picture

Issue summary: View changes

Small correction to IS.

quietone’s picture

Here's the full output. Also, note at the end their is output concerning the paragraphs module, which is a D8 version.

v@migrate {/opt/sites/md82} (8.0.x)$ !1937
drush dmu-analyze pants
Indexing...done.
exception 'InvalidArgumentException' with message '$string ("") must be a string.' in /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145                                 [error]
Stack trace:
#0 /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(115): Drupal\Core\StringTranslation\TranslatableMarkup->__construct(NULL, Array, Array,
Object(Drupal\Core\StringTranslation\TranslationManager))
#1 /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php(74): Drupal\Core\StringTranslation\TranslationManager->translate(NULL, Array, Array)
#2 /opt/sites/md82/modules/drupalmoduleupgrader/src/Plugin/DMU/Analyzer/FunctionCallDeriver.php(49): Drupal\drupalmoduleupgrader\DeriverBase->t(NULL, Array)
#3 /opt/sites/md82/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(105):
Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FunctionCallDeriver->getDerivativeDefinitions(Array)
#4 /opt/sites/md82/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(91): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
#5 /opt/sites/md82/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(268): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#6 /opt/sites/md82/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(168): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#7 /opt/sites/md82/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(108): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#8 /opt/sites/md82/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(244): _dmu_plugin_list('analyzer')
#9 [internal function]: drush_drupalmoduleupgrader_dmu_analyze('pants')
#10 /opt/drush/includes/command.inc(366): call_user_func_array('drush_drupalmod...', Array)
#11 /opt/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#12 [internal function]: drush_command('pants')
#13 /opt/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
#14 /opt/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#15 /opt/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 /opt/drush/drush.php(12): drush_main()
#17 {main}
Drupal\Core\Extension\InfoParserException: Unable to parse modules/paragraphs/modules/paragraphs_demo/paragraphs_demo.info.yml A colon cannot be used in an unquoted mapping value. in                  [error]
Drupal\Core\Extension\InfoParserDynamic->parse() (line 30 of /opt/sites/md82/core/lib/Drupal/Core/Extension/InfoParserDynamic.php).
quietone’s picture

Removing the paragraphs module from /modules resulted in:

@migrate {/opt/sites/md82/modules} (8.0.x)$ mv paragraphs/ ~
v@migrate {/opt/sites/md82/modules} (8.0.x)$ drush dmu-analyze pants
include_once(/opt/sites/md82/modules/paragraphs/paragraphs.module): failed to open stream: No such file or directory Extension.php:145                                                                  [warning]
include_once(): Failed opening '/opt/sites/md82/modules/paragraphs/paragraphs.module' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') Extension.php:145                                 [warning]
Indexing...done.
exception 'InvalidArgumentException' with message '$string ("") must be a string.' in /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145                                 [error]
Stack trace:
#0 /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(115): Drupal\Core\StringTranslation\TranslatableMarkup->__construct(NULL, Array, Array,
Object(Drupal\Core\StringTranslation\TranslationManager))
#1 /opt/sites/md82/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php(74): Drupal\Core\StringTranslation\TranslationManager->translate(NULL, Array, Array)
#2 /opt/sites/md82/modules/drupalmoduleupgrader/src/Plugin/DMU/Analyzer/FunctionCallDeriver.php(49): Drupal\drupalmoduleupgrader\DeriverBase->t(NULL, Array)
#3 /opt/sites/md82/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(105):
Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FunctionCallDeriver->getDerivativeDefinitions(Array)
#4 /opt/sites/md82/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(91): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
#5 /opt/sites/md82/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(268): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#6 /opt/sites/md82/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(168): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#7 /opt/sites/md82/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(108): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#8 /opt/sites/md82/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(244): _dmu_plugin_list('analyzer')
#9 [internal function]: drush_drupalmoduleupgrader_dmu_analyze('pants')
#10 /opt/drush/includes/command.inc(366): call_user_func_array('drush_drupalmod...', Array)
#11 /opt/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#12 [internal function]: drush_command('pants')
#13 /opt/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
#14 /opt/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#15 /opt/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 /opt/drush/drush.php(12): drush_main()
#17 {main}

No idea why it is looking for paragraphs. But let's try in a different root. Still get the fatal.

v@migrate {/opt/sites/md81} (8.0.x)$ drush dmu-analyze pants
Indexing...done.
exception 'InvalidArgumentException' with message '$string ("") must be a string.' in /opt/sites/md81/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:145                                 [error]
Stack trace:
#0 /opt/sites/md81/core/lib/Drupal/Core/StringTranslation/TranslationManager.php(115): Drupal\Core\StringTranslation\TranslatableMarkup->__construct(NULL, Array, Array,
Object(Drupal\Core\StringTranslation\TranslationManager))
#1 /opt/sites/md81/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php(74): Drupal\Core\StringTranslation\TranslationManager->translate(NULL, Array, Array)
#2 /opt/sites/md81/modules/drupalmoduleupgrader/src/Plugin/DMU/Analyzer/FunctionCallDeriver.php(49): Drupal\drupalmoduleupgrader\DeriverBase->t(NULL, Array)
#3 /opt/sites/md81/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(105):
Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FunctionCallDeriver->getDerivativeDefinitions(Array)
#4 /opt/sites/md81/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(91): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
#5 /opt/sites/md81/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(268): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#6 /opt/sites/md81/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(168): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#7 /opt/sites/md81/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(108): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#8 /opt/sites/md81/modules/drupalmoduleupgrader/drupalmoduleupgrader.drush.inc(244): _dmu_plugin_list('analyzer')
#9 [internal function]: drush_drupalmoduleupgrader_dmu_analyze('pants')
#10 /opt/drush/includes/command.inc(366): call_user_func_array('drush_drupalmod...', Array)
#11 /opt/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#12 [internal function]: drush_command('pants')
#13 /opt/drush/includes/command.inc(185): call_user_func_array('drush_command', Array)
#14 /opt/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#15 /opt/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 /opt/drush/drush.php(12): drush_main()
#17 {main}
quietone’s picture

I completely removed the code and file for the site, md82, the one with the paragraphs errors and rebuilt it. Installed drupalmoduleupgrader as per the README. The errors about paragraphs are now gone. Still have the "exception 'InvalidArgumentException'" though.

sutharsan’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB

This patch fixes these two cases of t() with empty (or NULL) string. In general is discouraged to use a variable as source string in t(), the source strings are not discovarable as translatable strings. Perhaps that is why t() does not bother about empty strings. :/

Perhaps there are more place where empty source strings may occur. But I leave that to others who have more knowledge of the internals of this module.

rteijeiro’s picture

Status: Needs review » Reviewed & tested by the community

Tested it and it works. Thanks Sutharsan for the fix! :)

opdavies’s picture

Worked for me also.

RTBC +1

criz’s picture

Also ran into this issue. Patch works for me.

almaudoh’s picture

Had the same error, so when I did a dump of the $info variable created in FlagHookDeriver::getDerivativeDefinitions() I saw something like this:

Array
(
    [message] => @hook has been replaced by a PSR-3 compatible logging system.
    [documentation] => Array
        (
            [0] => Array
                (
                    [url] => https://www.drupal.org/node/2270941
                    [title] => `@hook` removed; `watchdog()` deprecated and replaced by PSR-3 compliant logging service
                )
        )
    [tags] => Array
        (
            [category] => Array
                (
                    [0] => system
                )
        )
    [delete] => 1
    [hook] => Array
        (
            [0] => watchdog
        )
)
Array
(
    [default_config_hash] => RnoX4p74ZjCZ5rv9WHKte2juqTAnSp5FuiNEQeJ0StU
    [hook] => Array
        (
            [0] => _core
        )
)

It looks like a plugin is introducing the ['default_config_hash'] thing which is throwing a spanner in the works.. :(

almaudoh’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.59 KB

The problem is caused by the below entry introduced into the drupalmoduleupgrader.*.yml configurations during installation thereby corrupting the configs.

_core:
  default_config_hash: CKM38yHCv_8oYjIRmVoW0bydsBQ_Yt4N382O2D6qfBs

This was introduced in Drupal 8.0.2 by #2625258: LocaleConfigManager::updateConfigTranslations() deletes translations if a config object's name happens to match that of a shipped configuration object in the core issue queue. So while the patch in #6 solves the immediate problem, the extra plugin instance created may still cause problems later.

Best option would be to unset the $config['_core'] entry in the constructor as in attached patch.

alexpott’s picture

So... to cut a long story short. All configuration has to be at its base definition a mapping. So you can't have a config file that is an arbitrary sequence. Otherwise you can never add anything new and you fall into these sort of traps. See #2248709: The root type of a configuration object can not be a sequence for a discussion of this issue.

alexpott’s picture

Priority: Normal » Critical
StatusFileSize
new100.96 KB

So the easiest thing to do here will be to add another level where the root of the config file. To review the patch diff using --color-words - way less to review :)

Also this must be a critical bug as the module is completely broke without it right?

Another solution would be to move this stuff out of config into its own plugin definition yml files. Core does this for things link contextual link definitions and, to be honest, I don;t imagine a UI is ever going to exist to add these things so putting them in config seems unnecessary - but if we want to keep it in config then we have to play by core's (unfortunately implicit) rules.

gábor hojtsy’s picture

I agree with @alexpott. This seems like a misuse of the config system, unless you want/need a user interface for it. Either way, a config file must be be a config_object or config_entity, both of which are mappings.

almaudoh’s picture

StatusFileSize
new517 bytes
new100.96 KB

Fixed a small typo in #13 patch. Someone should please commit this. DMU is broken in so many ways :(

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

The last submitted patch, 13: 2635944.13.patch, failed testing.

The last submitted patch, 13: 2635944.13.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2635944-14.patch, failed testing.

The last submitted patch, 15: 2635944-14.patch, failed testing.

gábor hojtsy’s picture

Status: Needs work » Fixed

The branch tests fail with the same fails, so its not like its the fault of this patch.

gábor hojtsy’s picture

Well, this did not fix either of the 132 fails, but it did not introduce more quantitatively at least as per https://www.drupal.org/node/2196489/qa

Status: Fixed » Closed (fixed)

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

jhoe08’s picture

#6 Also work for me but I encounter this error

uc_eway does not implement hook_Array. [warning]
Error at line 3:1: unexpected < operator!

ressa’s picture

This error is still there, and the patch in #6 ( #2635944-6: InvalidArgumentException' with message '$string ("") ) still fixes it.

alansaviolobo’s picture

use 8.x-1.x-dev instead of 8.x-1.2. 8.x-1.2 was released in Sep 2015.

opdavies’s picture

It seems odd to me for a critical issue to be fixed, and for there not to be a new release following shortly afterwards so that people get the new version.

I'd suggest 1.3 is tagged when possible, but the dev version can be used currently.