From 7ebc385733d82f5420c199bd16639958f8fe3203 Mon Sep 17 00:00:00 2001 From: Benjamin Grandfond Date: Sun, 30 Sep 2012 10:47:54 +0200 Subject: [PATCH] [2.0][http-foundation] Fix Response::getDate method --- HeaderBag.php | 4 +++- Response.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/HeaderBag.php b/HeaderBag.php index a212f065e..b0f0536c4 100644 --- a/HeaderBag.php +++ b/HeaderBag.php @@ -226,7 +226,9 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return \DateTime The filtered value + * @return null|\DateTime The filtered value + * + * @throws \RuntimeException When the HTTP header is not parseable * * @api */ diff --git a/Response.php b/Response.php index bb729f7cb..7b68c3861 100644 --- a/Response.php +++ b/Response.php @@ -430,7 +430,7 @@ public function mustRevalidate() */ public function getDate() { - return $this->headers->getDate('Date'); + return $this->headers->getDate('Date', new \DateTime()); } /**