8000 bug #21462 [BrowserKit] ignore invalid cookies expires date format (x… · symfony/symfony@a6c05e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6c05e5

Browse files
committed
bug #21462 [BrowserKit] ignore invalid cookies expires date format (xabbuh)
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
2 parents f7ba71d + f19788d commit a6c05e5

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Symfony/Component/BrowserKit/Cookie.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ private static function parseDate($dateValue)
213213
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
214214
return $date->format('U');
215215
}
216-
217-
throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue));
218216
}
219217

220218
/**

src/Symfony/Component/BrowserKit/Tests/CookieTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
8888
Cookie::fromString('foo');
8989
}
9090

91-
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
91+
public function testFromStringIgnoresInvalidExpiresDate()
9292
{
93-
$this->setExpectedException('InvalidArgumentException');
94-
Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
93+
$cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
94+
95+
$this->assertFalse($cookie->isExpired());
9596
}
9697

9798
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()

0 commit comments

Comments
 (0)
0