Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpFoundation] NativeSessionStorageregenerate method wrongly sets storage as started#15799
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The Session Storage should not be flagged as started if`session_regenerate_id` fails. A common use case would be to attemptregeneration before actually starting the session.
This is to avoid flagging the storage as started(done by`loadSession()`) if the regeneration fails. Also, PHP 7 will throw anerror if a regeneration is attempted for non-active sessions.
regenerate wrongly sets storage as startedregenerate wrongly sets storage as startedregenerate wrongly sets storage as startedregenerate method wrongly sets storage as startediambrosi commentedSep 17, 2015
Updated title to followcontribution standards. |
fabpot commentedSep 22, 2015
👍 |
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.
PHP 5.4 and newer should usesession_status(). Seestart() method.
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.
Fixed!
`session_status()` should be used in PHP >= 5.4 instead of `session_id()`.
Tobion commentedSep 22, 2015
👍 |
Tobion commentedSep 22, 2015
Status: Reviewed |
fabpot commentedSep 28, 2015
Thank you@iambrosi. |
…wrongly sets storage as started (iambrosi)This PR was squashed before being merged into the 2.3 branch (closes#15799).Discussion----------[HttpFoundation] NativeSessionStorage `regenerate` method wrongly sets storage as started| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets || License | MIT| Doc PR |This PR fixes an error when regenerating session IDs for non-active sessions.Right now, the session is flagged as _started_, no matter if the session ID was successfully regenerated or not, making the storage [unable to _start the session_](https://github.com/symfony/symfony/blob/6393ec31690a3ecc73e5f1f7ea2185cda7aba203/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L130-L132) later on.This also fixes a future error with PHP 7, which throws an error if a regeneration is attempted for non-active sessions.```session_regenerate_id(): Cannot regenerate session id - session is not active```Commits-------8e6ef9c [HttpFoundation] NativeSessionStorage method wrongly sets storage as started
This PR fixes an error when regenerating session IDs for non-active sessions.
Right now, the session is flagged asstarted, no matter if the session ID was successfully regenerated or not, making the storageunable tostart the session later on.
This also fixes a future error with PHP 7, which throws an error if a regeneration is attempted for non-active sessions.