diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 7e855bf351..42f184d532 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -213,8 +213,6 @@ class Cookie if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) { return $date->format('U'); } - - throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue)); } /** diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 5a724333d3..4722de6d7b 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -88,10 +88,11 @@ class CookieTest extends \PHPUnit_Framework_TestCase Cookie::fromString('foo'); } - public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid() + public function testFromStringIgnoresInvalidExpiresDate() { - $this->setExpectedException('InvalidArgumentException'); - Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + $cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + + $this->assertFalse($cookie->isExpired()); } public function testFromStringThrowsAnExceptionIfUrlIsNotValid()