Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when running core:requirements with certain modules (e.g. o365) #6054

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

codebymikey
Copy link
Contributor

Describe the bug

Related to #6052

Following the addition of strict_type checking on commandfiles in #5450, running:

drush core:requirements

With certain modules, currently throws an exception:

TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, Drupal\Core\StringTranslation\TranslatableMarkup given in /app/application/vendor/drush/drush/src/Commands/core/DrupalCommands.php on line 104 #0 /app/application/vendor/drush/drush/src/Commands/core/DrupalCommands.php(104): str_replace(' ', '_', Object(Drupal\Core\StringTranslation\TranslatableMarkup))
#1 [internal function]: Drush\Commands\core\DrupalCommands->requirements(Array)
#2 /app/application/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#3 /app/application/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /app/application/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /app/application/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#6 /app/application/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /app/application/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/application/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))
#9 /app/application/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/application/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))
#11 /app/application/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /app/application/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#13 /app/application/vendor/drush/drush/drush(4): require('/app/applicatio...')
#14 /app/application/vendor/bin/drush(120): include('/app/applicatio...')
#15 {main}

To Reproduce
Install the o365 module, or any module which has a numeric requirement key, then running drush core:requirements will cause the fatal TypeError to occur.

Expected behavior
It should show the requirement status as expected.

Actual behavior
A fatal type error is shown.

Workaround
N/A. Except patching the module itself to use a non-numeric requirement key.

System Configuration

Q A
Drush version? 12.5.2.0
Drupal version? 10.2.7
PHP version 8.1.28
OS? Linux

Additional information
N/A

@weitzman weitzman merged commit 3927c4b into drush-ops:13.x Aug 2, 2024
1 check passed
@codebymikey codebymikey deleted the patch-4 branch October 25, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants