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

[debug:module] "module" argument provokes warning #4114

Closed
jensschulze opened this issue Jul 29, 2019 · 1 comment · Fixed by #4125
Closed

[debug:module] "module" argument provokes warning #4114

jensschulze opened this issue Jul 29, 2019 · 1 comment · Fixed by #4125

Comments

@jensschulze
Copy link
Contributor

Problem/Motivation

The module argument is not working at all because there is a type mismatch. The strtolower() function is executed on an array returned from $input->getArgument('module'). Thus the complete if ($modules) { … } branch is never executed and PHP emits a warning.
So we end up with the same behaviour as drupal dm without the module name(s) but with a big warning.

How to reproduce

Checked on Drupal Console 1.9.1 (Drupal Core version 8.7.5)

$ drupal dm token
ID                                                            Name                                                                                    Package                            Version        Schema version Status      Origin
 action                                                        Actions                                                                                 Core                               8.7.5                         Uninstalled core
 action_form_ajax_test                                         action_form_ajax_test                                                                   Core                               8.7.5                         Uninstalled core
 aggregator                                                    Aggregator                                                                              Core                               8.7.5                         Uninstalled core
 aggregator_test                                               Aggregator module tests                                                                 Testing                            8.7.5                         Uninstalled core
 aggregator_test_views                                         Aggregator test views                                                                   Testing                            8.7.5                         Uninstalled core
 automated_cron                                                Automated Cron                                                                          Core                               8.7.5          8000           Installed   core

… snip …

 webform_test_third_party_settings                             Webform module third party settings tests                                               Testing                            8.x-5.3                       Uninstalled no core
 webform_test_translation                                      Webform module translation tests                                                        Testing                            8.x-5.3                       Uninstalled no core
 webform_test_translation_lingotek                             Webform module translation lingotek tests                                               Testing                            8.x-5.3                       Uninstalled no core
 webform_test_validate                                         Webform module validate tests                                                           Testing                            8.x-5.3                       Uninstalled no core
 webform_test_views                                            Webform module Views tests                                                              Testing                            8.x-5.3                       Uninstalled no core
 webform_test_wizard_custom                                    Webform module wizard custom tests                                                      Testing                            8.x-5.3                       Uninstalled no core
 webform                                                       Webform                                                                                 Webform                            8.x-5.3        8169           Installed   no core


 [ERROR] <em class="placeholder">Warning</em>: strtolower() expects parameter
         1 to be string, array given in <em
         class="placeholder">Drupal\Console\Command\Debug\ModuleCommand-&gt;exec
         ute()</em> (line <em class="placeholder">87</em> of <em
         class="placeholder">/app/vendor/drupal/console/src/Command/Debug/Module
         Command.php</em>). <pre
         class="backtrace">Drupal\Console\Command\Debug\ModuleCommand-&gt;execut
         e(Object, Object) (Line: 255)
         Symfony\Component\Console\Command\Command-&gt;run(Object, Object)
         (Line: 987)
         Symfony\Component\Console\Application-&gt;doRunCommand(Object, Object,
         Object) (Line: 255)
         Symfony\Component\Console\Application-&gt;doRun(Object, Object) (Line:
         188)
         Drupal\Console\Core\Application-&gt;doRun(Object, Object) (Line: 64)
         Drupal\Console\Application-&gt;doRun(Object, Object) (Line: 148)
         Symfony\Component\Console\Application-&gt;run() (Line: 89)
         require(&#039;/app/vendor/drupal/console/bin/drupal.php&#039;) (Line:
         4)
         </pre>

Solution

Inside the if ($modules) { … } branch the command iterates over every given module, starting with line 93:

            foreach ($modules as $module) {

Here we can apply strtolower safely to every $module.

@jensschulze
Copy link
Contributor Author

PR #4115

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 a pull request may close this issue.

1 participant