drush
drush copied to clipboard
PHP 7.4 getDirectory() Error
Describe the bug
When upgrading Drush from 11.5.1
to 11.6.0
in our PHP 7.4
environments we noticed that our drush config:import
commands have stopped working due to a fatal error (below). We believe that this commit (Line 393) adds the mixed
type that was not introduced until PHP 8.
The Drush Compatibility page states that Drush 11.x should be compatible with PHP 7 and the use of the mixed
type violates that statement.
PHP.net states that the mixed
type was not introduced until PHP 8.0.0
.
TypeError: Argument 1 passed to Drush\Drupal\Commands\config\ConfigCommands::getDirectory() must be an instance of Drush\Drupal\Commands\config\mixed or null, string given, called in /drupal/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php on line 220 in /drupal/vendor/drush/drush/src/Drupal/Commands/config/ConfigCommands.php on line 393 #0 /drupal/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(220)
To Reproduce
To reproduce, simply upgrade Drush to 11.6.0
in a PHP 7.4
environment and run any drush config:import
command to import configuration.
Expected behavior The expected behavior is that the configuration would be imported.
Actual behavior The actual behavior is that the configuration is not imported due to a TypeError.
Workaround
Upgrade PHP to 8.0.0
+ or downgrade Drush to 11.5.1
.
System Configuration
Q | A |
---|---|
Drush version? | 11.6.0 |
Drupal version? | 9.5.9 |
PHP version | 7.4 |
OS? | Mac/Linux |
++ Attaching the screenshot for reference
I turned testing for PHP 7.4 back on in #5655 and fixed the issue reported here. There is one more test failure that needs to be fixed before we can merge and make a new release.
Thanks for fixing this issue. A new release will hopefully fix our integration tests: https://github.com/mkalkbrenner/search_api_solr/actions/runs/5280747852/jobs/9553368656
Just ran into this, and yeah, keeping Drush back at 11.5.1
seems to do the trick.