diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 62b67cce85..2f77858a47 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -373,12 +373,6 @@ class Response $this->sendHeaders(); $this->sendContent(); - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } elseif ('cli' !== PHP_SAPI) { - static::closeOutputBuffers(0, true); - } - return $this; } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8213df5cb8..26a6813e49 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -149,6 +149,14 @@ abstract class Kernel implements KernelInterface, TerminableInterface } if ($this->getHttpKernel() instanceof TerminableInterface) { + if (!$this->debug) { + if (function_exists('fastcgi_finish_request')) { + fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + Response::closeOutputBuffers(0, true); + } + } + $this->getHttpKernel()->terminate($request, $response); } }