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

Drush fails because "TRUE" gets passed into the Drush\Config\Environment::setLoader() call. #3049

Closed
erikfrerejean opened this issue Oct 10, 2017 · 6 comments

Comments

@erikfrerejean
Copy link

I've just installed a composer based project that includes drush, however all drush commands fail with the exception:

$ drush --help
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Drush\Config\Environment::setLoader() must be an instance of Composer\Autoload\ClassLoader, boolean given, called in /var/www/site/vendor/drush/drush/drush.php on line 57 and defined in /var/www/site/vendor/drush/drush/src/Config/Environment.php:219
Stack trace:
#0 /var/www/site/vendor/drush/drush/drush.php(57): Drush\Config\Environment->setLoader(true)
#1 /var/www/site/vendor/drush/drush/includes/preflight.inc(17): require('/var/www/site...')
#2 phar:///usr/local/bin/drush/bin/drush.php(139): drush_main()
#3 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#4 {main}
  thrown in /var/www/site/vendor/drush/drush/src/Config/Environment.php on line 219

To check I've dumped both $autoloadFile and $loader to see their values and ran drush status from the site directory.

$ drush status
string(58) "/var/www/site/vendor/drush/drush/../../autoload.php"
bool(true)

The path to autoload.php is correct and the file itself is readable, $loader however is the TRUE which normally is returned by include_once.

This happens on a CentOS 7 server running PHP 7.0.20, and using Drush 9.0.0-beta7.

@weitzman
Copy link
Member

weitzman commented Oct 10, 2017 via email

@erikfrerejean
Copy link
Author

erikfrerejean commented Oct 10, 2017

Running Drupal 8.4.

composer show output attached, drush status doesn't work since it throws the same exception before outputting anything.

I see phar:// in the backtrace. Is that drush8 or the drupal-launcher? what
version?
That is the drush launcher

@weitzman
Copy link
Member

weitzman commented Oct 10, 2017 via email

@greg-1-anderson
Copy link
Member

The autoloader returns the class loader the first time it is called, and returns true if it is called a second time. Drush 9 needs a reference to the class loader, so you shouldn't call the autoloader prior to launching Drush.

Older versions of the launcher loaded the autoloader and then included drush_main(). The newest launcher still does this for Drush 8, but skips loading the autoloader for Drush 9. You probably need to upgrade your launcher.

@erikfrerejean
Copy link
Author

Sorry for the delay, didn't have time to update the server. @greg-1-anderson, updating the launcher indeed fixed the issue.

@fede-green
Copy link

mhm sorry @erikfrerejean . looks i'm having the same problem here... how do you update the launcher?

thanks :)

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

No branches or pull requests

4 participants