Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a69cf15

Browse filesBrowse files
ivo95vnicolas-grekas
authored andcommitted
[HttpFoundation] Emit PHP warning when Response::sendHeaders() while output has already been sent
1 parent 7c43418 commit a69cf15
Copy full SHA for a69cf15

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed

‎src/Symfony/Component/HttpFoundation/Response.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Response.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ public function sendHeaders(?int $statusCode = null): static
317317
{
318318
// headers have already been sent by the developer
319319
if (headers_sent()) {
320+
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
321+
$statusCode ??= $this->statusCode;
322+
header(\sprintf('HTTP/%s %s %s', $this->version, $statusCode, $this->statusText), true, $statusCode);
323+
}
324+
320325
return $this;
321326
}
322327

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.