8000 [HttpFoundation] NativeSessionStorage `regenerate` method wrongly sets storage as started by iambrosi · Pull Request #15799 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] NativeSessionStorage regenerate 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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't regenerate the id of non-active sessions
This is to avoid flagging the storage as started(done by
`loadSession()`) if the regeneration fails. Also, PHP 7 will throw an
error if a regeneration is attempted for non-active sessions.
  • Loading branch information
iambrosi committed Sep 14, 2015
commit a269a914695c5a93bf40380b5dfa9e606f004bb1
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ public function setName($name)
*/
public function regenerate($destroy = false, $lifetime = null)
{
// Cannot regenerate the session ID for non-active sessions.
if ('' === session_id()) {
Copy link
Contributor

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 use session_status(). See start() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

return false;
}

if (null !== $lifetime) {
ini_set('session.cookie_lifetime', $lifetime);
}
Expand Down
0