Skip to content

Commit

Permalink
Fix CookieCollection::parseSetCookieHeader when the cookie has proper…
Browse files Browse the repository at this point in the history
…ties that are not expected in Cookie Object
  • Loading branch information
supermanner committed Aug 30, 2017
1 parent f270c98 commit 11375f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Http/Cookie/CookieCollection.php
Expand Up @@ -357,7 +357,7 @@ protected static function parseSetCookieHeader($values)
continue;
}
$key = strtolower($key);
if (!strlen($cookie[$key])) {
if (array_key_exists($key, $cookie) && !strlen($cookie[$key])) {
$cookie[$key] = $value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Http/Cookie/CookieCollectionTest.php
Expand Up @@ -436,7 +436,7 @@ public function testCreateFromHeader()
$header = [
'http=name; HttpOnly; Secure;',
'expires=expiring; Expires=Wed, 15-Jun-2022 10:22:22; Path=/api; HttpOnly; Secure;',
'expired=expired; Expires=Wed, 15-Jun-2015 10:22:22;',
'expired=expired; version=1; Expires=Wed, 15-Jun-2015 10:22:22;',
];
$cookies = CookieCollection::createFromHeader($header);
$this->assertCount(3, $cookies);
Expand Down

0 comments on commit 11375f7

Please sign in to comment.