Skip to content
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

Session is sometimes closed at this point #1839

Open
PhoenixFnX opened this issue Aug 9, 2023 · 1 comment
Open

Session is sometimes closed at this point #1839

PhoenixFnX opened this issue Aug 9, 2023 · 1 comment

Comments

@PhoenixFnX
Copy link

PhoenixFnX commented Aug 9, 2023

https://github.com/simplesamlphp/simplesamlphp/blob/a499a8a39e5572b7d80b8c182b06f9ec129133ac/src/SimpleSAML/SessionHandlerPHP.php#L237C5-L237C5

I'm developping an app with a custom session handler.
So I had to implement the handler reset :

// close session and restore default handler
session_write_close();
session_set_save_handler(new SessionHandler());

Then when I logout (but I can see a login problem too),
the session is clear of authData and this function saveSession is called.

It appears at this point the session_status() is PHP_SESSION_NONE.

I resolved my problem adding a session start at this point:

public function saveSession(\SimpleSAML\Session $session)
{
    @session_start();
    $_SESSION['SimpleSAMLphp_SESSION'] = serialize($session);
}
@tvdijen
Copy link
Member

tvdijen commented Sep 5, 2023

What happens if you try the following?:

// close session and restore default handler
session_write_close();
session_set_save_handler(SessionHandler::getSessionHandler());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants