Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow setting cookie values that will not be URL-encoded in the HttpFoundation\Cookie class #13646

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
dlancea opened this issue Feb 10, 2015 · 0 comments

Comments

@dlancea
Copy link

dlancea commented Feb 10, 2015

The HttpFoundation Cookie class accepts the value of the cookie but PHP will URL-encode the value when using the setcookie() function. This happens in the Response class:
https://github.com/symfony/HttpFoundation/blob/master/Response.php#L348

It would be nice if the Cookie class gave the option to not URL-encode the value. I'm working with a 3rd party application that I need to have use the same cookie, but it can't because it doesn't expect the value to be URL-encoded. This forces me to set the cookie using setrawcookie() outside of the framework.

I imagine the constructor for the Cookie class could have a "do url-encoding" parameter, defaulted to true. When set to false, the Response class could conditionally use setrawcookie() instead of setcookie().

@dlancea dlancea changed the title Allow for setting cookie values that are not URL-encoded in the HttpFoundation\Cookie class Allow setting cookie values that will not be URL-encoded in the HttpFoundation\Cookie clas Feb 11, 2015
@dlancea dlancea changed the title Allow setting cookie values that will not be URL-encoded in the HttpFoundation\Cookie clas Allow setting cookie values that will not be URL-encoded in the HttpFoundation\Cookie class Feb 11, 2015
fabpot added a commit that referenced this issue Mar 15, 2016
…n the response (jakzal)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpFoundation] Add support for sending raw cookies in the response

| Q             | A
| ------------- | ---
| Branch        | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #13646
| License       | MIT
| Doc PR        | TODO

Commits
-------

43760a6 [HttpFoundation] Add support for sending raw cookies in the response
@fabpot fabpot closed this as completed Mar 15, 2016
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

3 participants