From d9b90849bc4be884c83791cca0eec5dfec13f55e Mon Sep 17 00:00:00 2001 From: Antoine M Date: Mon, 24 Nov 2025 08:54:36 +0100 Subject: [PATCH] Update http_kernel.rst --- components/http_kernel.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 95dfd1e5344..70d113098ae 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -580,6 +580,17 @@ at the moment the exception was thrown. .. _http-kernel-creating-listener: +10) Resetting the state of request/response flow +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +PHP is designed to be stateless, there are no shared resources across different +requests. However, with some specific Runtime (ie FrankenPHP in worker mode), the +kernel can handle multiple request/response, and so you need to take care of cleaning +some services state to not leak memory if needed. + +To do so, your service must implement the :class:`Symfony\\Contracts\\Service\\ResetInterface` +where you can reset the properties in the ``reset()`` method. + Creating an Event Listener --------------------------