symfony/symfony — Issue #2881: [Symfony\Component\HttpKernel\Client] - more than one cookie - bug
Author: Kamil-Benedykcinski
Created: 2011-12-14 14:11:34+00:00
State: open

There is a bug in method filterResponse() of Symfony\Component\HttpKernel\Client.php.
There is in line 172:
$headers['Set-Cookie'] = implode(', ', $cookies);
and probably should be:
$headers['Set-Cookie'] = $cookies;

How to reproduce bug:
Set one than more cookie in action (in my case this is onAuthenticationSuccess method in login success handler):

public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
...
$response->headers->setCookie(new \Symfony\Component\HttpFoundation\Cookie('cookie1', base64_encode('value1'), time() + (3600 * 48), '/', '', false, false));
$response->headers->setCookie(new \Symfony\Component\HttpFoundation\Cookie('cookie2', base64_encode('value2'), time() + (3600 * 48), '/', '', false, false));
return $response;
}
Then you should receive exception during unittesting:
InvalidArgumentException: Could not parse date "Fri, 16 Dec 2011 14:06:26 GMT,cookie2=dmFsdWUy".