diff -u b/core/includes/bootstrap.inc b/core/includes/bootstrap.inc --- b/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2451,14 +2451,11 @@ // We do not use drupal_static() here because we do not have a mechanism by // which to reinitialize the stored objects, so a drupal_static_reset() call // would leave Drupal in a nonfunctional state. - static $container = NULL; + static $container = FALSE; if (isset($new_container)) { $container = $new_container; } - if ($container) { - return $container; - } - return FALSE; + return $container; } /** only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php @@ -30,11 +30,6 @@ public static function getInfo() { * Tests DIC compilation. */ function testCompileDIC() { - // Because we'll be instantiating a new kernel during this test, the - // container stored in drupal_container() will be updated as a side effect. - // We need to be able to restore it to the correct one at the end of this - // test. - $original_container = drupal_container(); $classloader = drupal_classloader(); global $conf; $conf['php_storage']['service_container']= array( @@ -63,9 +58,6 @@ function testCompileDIC() { !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder'); $this->assertTrue($is_compiled_container); - // Reset the container. - drupal_container(NULL, TRUE); - // Now use the read-only storage implementation, simulating a "production" // environment. $conf['php_storage']['service_container']['class'] = 'Drupal\Component\PhpStorage\FileReadOnlyStorage'; @@ -89,9 +81,6 @@ function testCompileDIC() { // modules. $this->assertFalse($container->has('bundle_test_class')); - // Reset the container. - drupal_container(NULL, TRUE); - // Add another module so that we can test that the new module's bundle is // registered to the new container. $module_enabled['bundle_test'] = 'bundle_test'; @@ -113,8 +102,5 @@ function testCompileDIC() { $classloader = $container->get('class_loader'); $refClass = new ReflectionClass($classloader); $this->assertTrue($refClass->hasMethod('getNamespaces'), 'Container has a classloader'); - - // Restore the original container. - drupal_container($original_container); } }