diff -u b/core/lib/Drupal.php b/core/lib/Drupal.php --- b/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -116,10 +116,10 @@ * @return \Symfony\Component\DependencyInjection\ContainerInterface */ public static function getContainer($check_only = FALSE) { - if (!$check_only && !static::$container) { - throw new Exception('Container not found'); + if (static::$container || $check_only) { + return static::$container; } - return static::$container; + throw new Exception('Container not found'); } /**