8000 [Symfony\Component\HttpKernel\Client] - more than one cookie - bug · Issue #2881 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Symfony\Component\HttpKernel\Client] - more than one cookie - bug #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kamil-Benedykcinski opened this issue Dec 14, 2011 · 0 comments
Closed

Comments

@Kamil-Benedykcinski
Copy link

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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0