merged branch jfsimon/issue-7039 (PR #7347)
This PR was merged into the 2.1 branch.
Commits
-------
fc47589
[BrowserKit] added ability to ignored malformed set-cookie header
Discussion
----------
[BrowserKit] adds ability to ignore malformed set-cookie header
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #7039
This commit is contained in:
commit
940d591dc2
@ -109,7 +109,11 @@ class CookieJar
|
||||
}
|
||||
|
||||
foreach ($cookies as $cookie) {
|
||||
$this->set(Cookie::fromString($cookie, $uri));
|
||||
try {
|
||||
$this->set(Cookie::fromString($cookie, $uri));
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// invalid cookies are just ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,13 @@ class CookieJarTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('bar', $cookieJar->get('bar')->getValue(), '->updateFromSetCookie() keeps existing cookies');
|
||||
}
|
||||
|
||||
public function testUpdateFromEmptySetCookie()
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
$cookieJar->updateFromSetCookie(array(''));
|
||||
$this->assertEquals(array(), $cookieJar->all());
|
||||
}
|
||||
|
||||
public function testUpdateFromSetCookieWithMultipleCookies()
|
||||
{
|
||||
$timestamp = time() + 3600;
|
||||
|
Reference in New Issue
Block a user