Skip to content

[BrowserKit] ignore invalid cookies expires date format #21462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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