Problem/Motivation

In order for #2363341: Throw exception in Drupal::service() and friends, if container not initialized yet. to go in, we have to fix Drush first. This just adds the \Drupal::hasContainer() method, and then once Drush is updated, the other issue can proceed.

Proposed resolution

Add \Drupal::hasContainer() instead of checking if \Drupal::getContainer() === NULL

Remaining tasks

N/A

User interface changes

API changes

CommentFileSizeAuthor
#1 2421005-hasContainer-1.patch1.94 KBtim.plunkett

Comments

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new1.94 KB
alexpott’s picture

Looks like we'll need to get a fix into drush as well so #2404923: Upgrade Drush on qa.d.o is relevant or even #2206501: Remove dependency on Drush from test reviews (I can dream!)

neclimdul’s picture

Status: Needs review » Reviewed & tested by the community

Pretty straight forward improvement

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 2bf5573 and pushed to 8.0.x. Thanks!

  • alexpott committed 2bf5573 on 8.0.x
    Issue #2421005 by tim.plunkett: Add \Drupal::hasContainer() instead of...
cjwest’s picture

I just rebuilt drush and my site. Upon executing

drush en

I'm receiving:

Fatal error: Call to undefined method Drupal::hashContainer() in .composer/vendor/drush/drush/lib/Drush/Boot/bootstrap.inc on line 824
Drush command terminated abnormally due to an unrecoverable error.

tim.plunkett’s picture

I hope that's a typo

hashContainer
should be
hasContainer

joelpittet’s picture

@cjwest maybe there was a bug in drush, can you upgrade to the latest master branch?

berdir’s picture

The problem can't be resolved by updating drush, it exists *because* drush was updated and now requires a Drupal Core that has change included. Fairly sure that hashContainer() is just a typo here.

You need to either update core or apply the patch here to your current version, which is fairly easy. I had to do the same.

joelpittet’s picture

Ahhh chickens and eggs.

medienverbinder’s picture

Fresh installation drupal 8.0.0-beta6
Drush did not work. (example: drush st)
I got the following error

PHP Fatal error:  Call to undefined method Drupal::hasContainer() in .composer/vendor/drush/drush/lib/Drush/Boot/bootstrap.inc on line 824
Drush command terminated abnormally due to an unrecoverable error. 

With the patch everything works fine!

Many thanks to tim.plunkett.

flashwebcenter’s picture

Thank you very much tim.plunkett for the patch.

geerlingguy’s picture

Though I know this is in master, it's the only patch required to get drush head to work installing Drupal 8.0.x-beta6 with drush si.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.