-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix Session::configure() to add cookie prefix to cookie name #5951
Conversation
Thank you for sending a PR. We expect all contributions to conform to our style guide, be commented (inside the PHP source files), be documented (in the user guide), and unit tested (in the test folder). |
I don't know this is a bug or not. |
I understand that it may not be a bug and that it comes from CI3, but the behavior of creating a cookie should be transversal to the entire framework |
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 don't have a lot of experience with Session configuration so I'm not sure what is "normal" but this seems like a logical fix to me. Other than disrupting existing sessions, what about this would constitute a breaking change?
Session cookies are cookies, so this is logical.
The only change of this PR is the session cookie name. Wouldn't that be a breaking change, since all visitors would be forced to log out after the upgrade? |
I don't know! I don't use long-term sessions, and in some projects I actually have new releases spin up on a new server, so this is always the case. But there might be scenarios where people need session cookies to persist? Semver I think would say that this is a collateral effect that should be documented but since it does change the public API it does not require a major version release. |
What do you mean? If we are changing the public API, SemVer requires a major version release, right? Anyway, it is the documented specification that the session cookie does not use Personally, I don't see much value in this change. If users need the prefix, just add it in the session settings. |
Understood. I will go with @kenjis on this one. |
@pjsde This is not a bug, but is clearly documented. So we can't change easily. See the Note:
|
When the
\CodeIgniter\Session\Session
class creates the cookie, it is not adding the prefix that was defined in\Config\Cookie::$prefix
to the name, so the name of the generated cookie is incomplete without having the prefix that was defined in the config.To maintain consistency with the
\CodeIgniter\Cookie\Cookie
class, this change must be made so that the creation of the session cookie follows the same conditions as the creation of a normal cookie.Checklist: