-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Fix cookie to string conversion for raw cookies #20910
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
Conversation
if ($this->path) { | ||
$str .= '; path='.$this->path; | ||
} | ||
$str .= '; path='.$this->getPath() ?: '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #20569 (comment) for my reasoning behind this. Im also fine with if ($this->getPath()) { ... }
in case the user breaks the contract from a subclass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep the condition to keep the payload small (I know that path= /
is not that long, but as this is optional, let's do it that way).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. However source of the problem is https://github.com/symfony/symfony/pull/20910/files#diff-a1e299c557d5ff5fde6fa480eab85d47R70
If it's truly optional (and it is :)) symfony should make no assumptions on empty values. Imo. passing $path=null
, $path=''
, $path='/'
should all behave as expected, respectively; <no-path>
, path=;
, path=/;
Perhaps something to look into later on. For now ill put back the condition 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Failing test (PHP7/redis) seems unrelated. |
Thank you @ro0NL. |
…ookies (ro0NL) This PR was squashed before being merged into the 3.1 branch (closes #20910). Discussion ---------- [HttpFoundation] Fix cookie to string conversion for raw cookies | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | not really | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20569 (comment) | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> Separated from #20569 This mimics PHP's `setrawcookie` behavior. Commits ------- 5e899cd [HttpFoundation] Fix cookie to string conversion for raw cookies
Separated from #20569
This mimics PHP's
setrawcookie
behavior.