-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] PHP7.2 session migration error #28577
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
Comments
Can you create a small example application that allows to reproduce your issue? |
Thank for your help. |
This is the repo with the sample : https://github.com/Flofr/Bug-session-php7.2-sf2.8 You have to go on the login page /login with the login "test" and pwd "test" |
Hi, |
For helping you, the test in Symfony code is not complete. |
I am not sure what we can do here. Maybe deprecate being able to pass a lifetime here? |
@xabbuh is this still a bug ? |
I think so. |
What's wrong with using session_set_cookie_params? https://www.php.net/manual/en/function.session-set-cookie-params.php |
Note that the manual might give the wrong impression that it's just a wrapper for ini_set, TIAS. |
You're probably going to just have to session destroy then recreate or something.
Set what that does, otherwise may just have to look at the PHP source. Hopefully nothing unpleasant would be needed such as session_encode/session_decode, etc. Might want some other hacks for other places like session_id to set, etc. Personally I usually end up just not using the PHP handler for sessions as it has been causing me headaches since 2008. You don't get proper locking, it's stuck as a singleton, etc. Don't know why you would make a framework only to fallback to a flawed by design session API. It's only good for prototyping, mockups and simple use cases. |
We had a quite hard fight with this one (zikula/core#3898, zikula/core#3986, zikula/core#4078), but now I think this is solved.
Yes. I finally found a fix that seems to work. Background of the problem: First, the So what I did is this: zikula/core@e3b9d42...c7e625a It looks a bit confusing because I had to duplicate some code of the class in my child class (due to #35460). The actual fix (it looks so simple) is replacing: ini_set('session.cookie_lifetime', $lifetime); by: $this->save();
ini_set('session.cookie_lifetime', $lifetime);
$this->start(); |
…e lifetime (Guite) This PR was squashed before being merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Fixed session migration with custom cookie lifetime | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #28577 | License | MIT | Doc PR | This PR adds the fix proposed in #28577 (comment) Commits ------- 3e824de [HttpFoundation] Fixed session migration with custom cookie lifetime
…e lifetime (Guite) This PR was squashed before being merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Fixed session migration with custom cookie lifetime | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #28577 | License | MIT | Doc PR | This PR adds the fix proposed in symfony/symfony#28577 (comment) Commits ------- 3e824de385 [HttpFoundation] Fixed session migration with custom cookie lifetime
Hello,
I upgrade my PHP version from PHP 5.6.36 to PHP 7.2, but I have a problem when I want to use the migrate function of Session component.
My simple line of code :
$this->request->getSession()->migrate(true, $newLifetime);
The error returned :
Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time
I have already a session opened before by my login page, but I want to change the session life time on login.
My Symfony version 2.8.44
Thanks for your help
The text was updated successfully, but these errors were encountered: