diff --git a/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/src/Symfony/Component/HttpFoundation/CHANGELOG.md index d504dac2c3ee2..61297e2c148b1 100644 --- a/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -8,6 +8,7 @@ CHANGELOG * Support root-level `Generator` in `StreamedJsonResponse` * Add `UriSigner` from the HttpKernel component * Add `partitioned` flag to `Cookie` (CHIPS Cookie) + * Add argument `bool $flush = true` to `Response::send()` 6.3 --- diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 4b56449e04818..29db6297f183e 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -415,13 +415,20 @@ public function sendContent(): static /** * Sends HTTP headers and content. * + * @param bool $flush Whether output buffers should be flushed + * * @return $this */ - public function send(): static + public function send(/* bool $flush = true */): static { $this->sendHeaders(); $this->sendContent(); + $flush = 1 <= \func_num_args() ? func_get_arg(0) : true; + if (!$flush) { + return $this; + } + if (\function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); } elseif (\function_exists('litespeed_finish_request')) { diff --git a/src/Symfony/Component/Runtime/CHANGELOG.md b/src/Symfony/Component/Runtime/CHANGELOG.md index 3f5d90c8db902..1a608b4cf734b 100644 --- a/src/Symfony/Component/Runtime/CHANGELOG.md +++ b/src/Symfony/Component/Runtime/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +6.4 +--- + + * Add argument `bool $debug = false` to `HttpKernelRunner::__construct()` + 5.4 --- diff --git a/src/Symfony/Component/Runtime/Runner/Symfony/HttpKernelRunner.php b/src/Symfony/Component/Runtime/Runner/Symfony/HttpKernelRunner.php index e840623027492..a5176a9ca309a 100644 --- a/src/Symfony/Component/Runtime/Runner/Symfony/HttpKernelRunner.php +++ b/src/Symfony/Component/Runtime/Runner/Symfony/HttpKernelRunner.php @@ -24,13 +24,14 @@ class HttpKernelRunner implements RunnerInterface public function __construct( private readonly HttpKernelInterface $kernel, private readonly Request $request, + private readonly bool $debug = false, ) { } public function run(): int { $response = $this->kernel->handle($this->request); - $response->send(); + $response->send(!$this->debug); if ($this->kernel instanceof TerminableInterface) { $this->kernel->terminate($this->request, $response); diff --git a/src/Symfony/Component/Runtime/SymfonyRuntime.php b/src/Symfony/Component/Runtime/SymfonyRuntime.php index 34a2097dc0ab3..e88e1e0891cc9 100644 --- a/src/Symfony/Component/Runtime/SymfonyRuntime.php +++ b/src/Symfony/Component/Runtime/SymfonyRuntime.php @@ -131,7 +131,7 @@ public function __construct(array $options = []) public function getRunner(?object $application): RunnerInterface { if ($application instanceof HttpKernelInterface) { - return new HttpKernelRunner($application, Request::createFromGlobals()); + return new HttpKernelRunner($application, Request::createFromGlobals(), $this->options['debug'] ?? false); } if ($application instanceof Response) {
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: