8000 [HttpFoundation] Postpone setting the date header on a Response · symfony/symfony@b804502 · GitHub
[go: up one dir, main page]

Skip to content

Commit b804502

Browse files
committed
[HttpFoundation] Postpone setting the date header on a Response
1 parent 567af65 commit b804502

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ public function __construct($content = '', $status = 200, $headers = array())
202202
$this->setContent($content);
203203
$this->setStatusCode($status);
204204
$this->setProtocolVersion('1.0');
205-
if (!$this->headers->has('Date')) {
206-
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
207-
}
208205
}
209206

210207
/**
@@ -333,6 +330,10 @@ public function sendHeaders()
333330
return $this;
334331
}
335332

333+
if (!$this->headers->has('Date')) {
334+
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
335+
}
336+
336337
// status
337338
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
338339

0 commit comments

Comments
 (0)
0