Skip to content

Commit 2970be3

Browse files
committed
[HttpFoundation] Add $flush parameter to Response::send()
1 parent da6dc96 commit 2970be3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* Support root-level `Generator` in `StreamedJsonResponse`
99
* Add `UriSigner` from the HttpKernel component
1010
* Add `partitioned` flag to `Cookie` (CHIPS Cookie)
11+
* Add argument `bool $flush = true` to `Response::send()`
1112

1213
6.3
1314
---

Response.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,20 @@ public function sendContent(): static
415415
/**
416416
* Sends HTTP headers and content.
417417
*
418+
* @param bool $flush Whether output buffers should be flushed
419+
*
418420
* @return $this
419421
*/
420-
public function send(): static
422+
public function send(/* bool $flush = true */): static
421423
{
422424
$this->sendHeaders();
423425
$this->sendContent();
424426

427+
$flush = 1 <= \func_num_args() ? func_get_arg(0) : true;
428+
if (!$flush) {
429+
return $this;
430+
}
431+
425432
if (\function_exists('fastcgi_finish_request')) {
426433
fastcgi_finish_request();
427434
} elseif (\function_exists('litespeed_finish_request')) {

0 commit comments

Comments
 (0)