Don't prevent destruction without preHandle having been run.
Closes #3412556
Merge request reports
Activity
added 1 commit
- 3d9daf17 - Add additional assertions to OpenTelemetryNodePagePerformanceTest
added 1 commit
- 2fdad3d4 - Inline the logic from KernelDestructionSubscriber
- Resolved by Alex Pott
687 687 public function terminate(Request $request, Response $response) { 688 688 // Only run terminate() when essential services have been set up properly 689 689 // by preHandle() before. 690 if (FALSE === $this->prepared) { 691 return; 692 } 693 694 690 if ($this->getHttpKernel() instanceof TerminableInterface) { 695 $this->getHttpKernel()->terminate($request, $response); 691 if (TRUE === $this->prepared) { 692 $this->getHttpKernel()->terminate($request, $response); 693 } 694 // However always allow any instantiated services to destruct. 695 $this->container->get('kernel_destruct_subscriber')->onKernelTerminate(); - Comment on lines +694 to +695
How about adding something like
$container->setParameter('kernel.services_for_destruction', array_keys($services));
to \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass
And then inlining the code...
694 // However always allow any instantiated services to destruct. 695 $this->container->get('kernel_destruct_subscriber')->onKernelTerminate(); 694 // Always allow any instantiated services to destruct. 695 // @see \Drupal\Core\DependencyInjection\Compiler\RegisterServicesForDestructionPass 696 foreach ($this->container->getParameter('kernel.services_for_destruction') as $service_id) { 697 // Check if the service was initialized during this request, destruction 698 // is not necessary if the service was not used. 699 if ($this->container->initialized($service_id)) { 700 $service = $this->container->get($service_id); 701 $service->destruct(); 702 } 703 } We also should file a follow to replace the tag with checking if the service implements \Drupal\Core\DestructableInterface
changed this line in version 18 of the diff
added 2 commits
- Resolved by catch
- Resolved by catch
Please register or sign in to reply