Permalink
Browse files

bug #21462 [BrowserKit] ignore invalid cookies expires date format (x…

…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...
2 parents f7ba71d + f19788d commit a6c05e5fb677cc3c8ffa07f86652366ac0060b3e @fabpot fabpot committed Jan 30, 2017
@@ -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));
}
/**
@@ -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()

0 comments on commit a6c05e5

Please sign in to comment.