- Issue created by @longwave
- 🇬🇧United Kingdom longwave UK
This event subscriber has slowly been chipped away at over the years:
#1698108: Update Drupal's dependencies →
#1541674: Remove the registry →
#1269742: Make path lookup code into a pluggable class →
#1331486: Move module_invoke_*() and friends to an Extensions class →
#1911178: Remove hook_exit() →
#2220687: Convert system_run_automated_cron into a subscriber for KernelEvents::TERMINATE →
#2231419: Merge obsolete CachedModuleHandler into ModuleHandler →Time to finally retire it?
- Status changed to Needs review
9 months ago 10:21pm 27 March 2024 - Status changed to RTBC
9 months ago 5:27am 28 March 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
As per https://www.drupal.org/about/core/policies/core-change-policies/bc-polic... → event subscribers are not part of the API so we can remove this class without a deprecation.
One thing I wonder is how will this cache be written if doing some event loop type thing with Drupal.
- 🇬🇧United Kingdom longwave UK
Does that make any difference here?
DrupalKernel::terminate()
:if ($this->prepared === TRUE) { $this->getHttpKernel()->terminate($request, $response); } // For destructable services, always call the destruct method if they were // initialized during the request. Destruction is not necessary if the // service was not used. foreach ($this->container->getParameter('kernel.destructable_services') as $id) { if ($this->container->initialized($id)) { $service = $this->container->get($id); $service->destruct(); } }
KernelEvents::TERMINATE
is fired duringHttpKernel::terminate()
, we've just moved the subscribed method down to the destruction loop instead. - 🇬🇧United Kingdom alexpott 🇪🇺🌍
Good point. 1 less service FTW!
Committed and pushed 4a26ee1f81 to 11.x and 2505f212bf to 10.3.x. Thanks!
-
alexpott →
committed 2505f212 on 10.3.x
Issue #3436599 by longwave: Replace RequestCloseSubscriber with...
-
alexpott →
committed 2505f212 on 10.3.x
- Status changed to Fixed
9 months ago 10:30am 28 March 2024 -
alexpott →
committed 4a26ee1f on 11.x
Issue #3436599 by longwave: Replace RequestCloseSubscriber with...
-
alexpott →
committed 4a26ee1f on 11.x
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
I did check contrib... i think there are no issues with removing the class - https://git.drupalcode.org/search?group_id=2&repository_ref=&scope=blobs...
Automatically closed - issue fixed for 2 weeks with no activity.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
After deploy the last version of Drupal 10.3.5 we got the following error:
Error: Class "Drupal\Core\EventSubscriber\RequestCloseSubscriber" not found in Drupal\Component\DependencyInjection\Container->createService() (line 259 of /mnt/www/html/drschar/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php) #0 /mnt/www/html/drschar/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'request_close_s...') #1 /mnt/www/html/drschar/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(105): Drupal\Component\DependencyInjection\Container->get('request_close_s...') #2 /mnt/www/html/drschar/vendor/symfony/http-kernel/HttpKernel.php(115): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\TerminateEvent), 'kernel.terminat...') #3 /mnt/www/html/drschar/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(63): Symfony\Component\HttpKernel\HttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #4 /mnt/www/html/drschar/docroot/core/lib/Drupal/Core/DrupalKernel.php(688): Drupal\Core\StackMiddleware\StackedHttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #5 /mnt/www/html/drschar/docroot/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #6 @main.