diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 00b9f9f..a707240 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -927,33 +927,6 @@ protected function initializeCookieGlobals(Request $request) { } /** - * Returns service instances to persist from an old container to a new one. - */ - protected function getServicesToPersist(ContainerInterface $container) { - $persist = array(); - foreach ($container->getParameter('syntheticIds') as $id) { - // It's pointless to persist services not yet initialized. - if ($container->initialized($id)) { - $persist[$id] = $container->get($id); - } - } - return $persist; - } - - /** - * Moves persistent service instances into a new container. - */ - protected function persistServices(ContainerInterface $container, array $persist) { - foreach ($persist as $id => $object) { - // Do not override services already set() on the new container, for - // example 'service_container'. - if (!$container->initialized($id)) { - $container->set($id, $object); - } - } - } - - /** * Force a container rebuild. * * @return \Symfony\Component\DependencyInjection\ContainerInterface @@ -974,12 +947,6 @@ public function rebuildContainer() { * @return ContainerInterface */ protected function attachSynthetic(ContainerInterface $container) { - $persist = array(); - if (isset($this->container)) { - $persist = $this->getServicesToPersist($this->container); - } - $this->persistServices($container, $persist); - // All namespaces must be registered before we attempt to use any service // from the container. $this->classLoaderAddMultiplePsr4($container->getParameter('container.namespaces')); @@ -1000,6 +967,9 @@ protected function attachSynthetic(ContainerInterface $container) { while ($request = array_shift($requests)) { $container->get('request_stack')->push($request); + } + + if ($request) { $container->get('router.request_context')->fromRequest($request); } } @@ -1087,17 +1057,6 @@ protected function compileContainer() { } } - // Identify all synthetic services whose instances need to be persisted when - // rebuilding the container during the lifetime of the kernel (e.g., during - // a kernel reboot). - $synthetic_ids = array(); - foreach ($container->getDefinitions() as $id => $definition) { - if ($definition->isSynthetic()) { - $synthetic_ids[] = $id; - } - } - $container->setParameter('syntheticIds', $synthetic_ids); - $container->compile(); return $container; }