drush
drush copied to clipboard
Fatal error when --root options provided without a value
To Reproduce
drush st --root
Expected behavior A message saying that the "--root" option requires a value.
Actual behavior
PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, null given in /var/www/d10/web/vendor/drush/drush/src/Utils/StringUtils.php:94
Stack trace:
#0 /var/www/d10/web/vendor/drush/drush/src/Utils/StringUtils.php(94): preg_match()
#1 /var/www/d10/web/vendor/drush/drush/src/Preflight/PreflightArgs.php(274): Drush\Utils\StringUtils::replaceTilde()
#2 [internal function]: Drush\Preflight\PreflightArgs->setSelectedSite()
#3 /var/www/d10/web/vendor/drush/drush/src/Preflight/ArgsPreprocessor.php(87): call_user_func()
#4 /var/www/d10/web/vendor/drush/drush/src/Preflight/Preflight.php(172): Drush\Preflight\ArgsPreprocessor->parse()
#5 /var/www/d10/web/vendor/drush/drush/src/Preflight/Preflight.php(255): Drush\Preflight\Preflight->preflightArgs()
#6 /var/www/d10/web/vendor/drush/drush/src/Runtime/Runtime.php(58): Drush\Preflight\Preflight->preflight()
#7 /var/www/d10/web/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#8 /var/www/d10/web/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#9 /var/www/d10/web/vendor/drush/drush/drush(4): require('...')
#10 /var/www/d10/web/vendor/bin/drush(119): include('...')
#11 {main}
thrown in /var/www/d10/web/vendor/drush/drush/src/Utils/StringUtils.php on line 94
System Configuration
| Q | A |
|---|---|
| Drush version? | 12.x |
| Drupal version? | 10.x |
| PHP version | 8.x |
| OS? | Linux |
Additional information
The --uri option is also not complaining about missing value.
On the other hand the --define option does it the right way.