Skip to content

Commit

Permalink
ignore invalid cookies expires date format
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 30, 2017
1 parent f7ba71d commit f19788d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/Symfony/Component/BrowserKit/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ private static function parseDate($dateValue)
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
return $date->format('U');
}

throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue));
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Symfony/Component/BrowserKit/Tests/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
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()
Expand Down

0 comments on commit f19788d

Please sign in to comment.