diff --git a/core/lib/Drupal/Component/DependencyInjection/Container.php b/core/lib/Drupal/Component/DependencyInjection/Container.php index df25ae8..0b3eb70 100644 --- a/core/lib/Drupal/Component/DependencyInjection/Container.php +++ b/core/lib/Drupal/Component/DependencyInjection/Container.php @@ -626,4 +626,11 @@ public function getServiceIds() { return array_keys($this->serviceDefinitions + $this->services); } + /** + * @inheritDoc + */ + private function __clone() { + throw new \Exception('Can not clone the container'); + } + } diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index a4c115f..b255dea 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1194,7 +1194,7 @@ private function prepareEnvironment() { $this->originalConf = isset($GLOBALS['conf']) ? $GLOBALS['conf'] : NULL; // Backup statics and globals. - $this->originalContainer = clone \Drupal::getContainer(); + $this->originalContainer = \Drupal::getContainer(); $this->originalLanguage = $language_interface; $this->originalConfigDirectories = $GLOBALS['config_directories'];