Skip to content

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

@dlancea

Description

@dlancea

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().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions