Skip to content

Commit

Permalink
bug #21462 [BrowserKit] ignore invalid cookies expires date format (x…
Browse files Browse the repository at this point in the history
…abbuh)

This PR was merged into the 2.7 branch.

Discussion
----------

[BrowserKit] ignore invalid cookies expires date format

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15656
| License       | MIT
| Doc PR        |

Commits
-------

f19788d ignore invalid cookies expires date format
  • Loading branch information
fabpot committed Jan 30, 2017
2 parents f7ba71d + f19788d commit a6c05e5
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 a6c05e5

Please sign in to comment.