8000 Cookie-Names are prefixed with "Set-Cookie:" by AbstractSessionHandler::destroy · Issue #25393 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Cookie-Names are prefixed with "Set-Cookie:" by AbstractSessionHandler::destroy #25393

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
pableu opened this issue Dec 8, 2017 · 5 comments
Closed

Comments

@pableu
Copy link
Contributor
pableu commented Dec 8, 2017

When creating cookies using setcookie() whilst having a session started, our own cookies are prefixed by "Set-Cookie".

I think the issue becomes quite obvious by reading AbstractSessionHandler::destroy:

In line 143, all headers that don't start with "Set-Cookie:" are skipped. Then in Lines 150 and 153, they are added to $otherCookies.

In line 159, they are prefixed again with "Set-Cookie:" and passed to header(). This results in headers such as Set-Cookie: Set-Cookie: test=foo; path=/.

I think the correct solution would be to change line 159 to header($h, false);.

Symfony Version: 3.4.1
PHP-Version: 7.0.22
OS: Ubuntu 16.04

Some Screenshots from the Chrome Devtools:
Headers:
headers
Cookies: cookies

@Simperfit
Copy link
Contributor

Do you want to provide the Pull Request ?

8000

@pableu
Copy link
Contributor Author
pableu commented Dec 8, 2017

Does #25398 work?

nicolas-grekas added a commit that referenced this issue Dec 8, 2017
…pableu)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] don't prefix cookies with "Set-Cookie:"

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | ?
| Fixed tickets | #25393
| License       | MIT

Commits
-------

a4db20f [HttpFoundation] don't prefix cookies with "Set-Cookie:"
symfony-splitter pushed a commit to symfony/http-foundation that referenced this issue Dec 8, 2017
@nicolas-grekas
Copy link
Member

Perfectly, thank's for it, and congrats for your first PR!

@Simperfit
Copy link
Contributor

Congrats for the first PR !

@pableu
Copy link
Contributor Author
pableu commented Dec 8, 2017

Great! Thanks for accepting it so quickly :-)

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

No branches or pull requests

5 participants
0