Skip to content

Commit

Permalink
Check for runtime.argv array size before use (#4887) (#4921)
Browse files Browse the repository at this point in the history
Otherwise we run into warnings when `drush` is run with no commands:

```shell
$ drush
 [warning] Undefined array key 1 Application.php:199
(...)
```

Closes: #4887
  • Loading branch information
diegoe committed Dec 12, 2021
1 parent 140081a commit 33c5631
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ public function find($name)
$command = $this->bootstrapAndFind($name);
// Avoid exception when help is being built by https://github.com/bamarni/symfony-console-autocomplete.
// @todo Find a cleaner solution.
if (Drush::config()->get('runtime.argv')[1] !== 'help') {
$argv = Drush::config()->get('runtime.argv');
if (count($argv) > 1 && $argv[1] !== 'help') {
$this->checkObsolete($command);
}
return $command;
Expand Down

0 comments on commit 33c5631

Please sign in to comment.