drush-ops / drush

Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt.
https://www.drush.org
2.34k stars 1.08k forks source link

PHP 7.4 getDirectory() Error #5655

Open ghazlawl opened 1 year ago

ghazlawl commented 1 year ago

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
apathak18 commented 1 year ago

++ Attaching the screenshot for reference

Screenshot 2023-06-14 at 9 24 53 AM
greg-1-anderson commented 1 year ago

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.

mkalkbrenner commented 1 year ago

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

adam-vessey commented 1 year ago

Just ran into this, and yeah, keeping Drush back at 11.5.1 seems to do the trick.