Skip to content
Snippets Groups Projects
Unverified Commit ab344d88 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Fix a bug in the PHP session handler

When unserializing the session fails, the handler should return null instead of false. Additionally, SimpleSAML_Session::load() should make sure that it got an instance of SimpleSAML_Session, to avoid any misbehaving handlers to generate an issue.

This resolves #616.
parent c3025c85
No related branches found
No related tags found
No related merge requests found
......@@ -270,7 +270,7 @@ class SimpleSAML_Session implements Serializable
}
// if getSession() found it, use it
if ($session !== null) {
if ($session instanceof SimpleSAML_Session) {
return self::load($session);
}
......@@ -311,7 +311,7 @@ class SimpleSAML_Session implements Serializable
*
* @param string|null $sessionId The session we should get, or null to get the current session.
*
* @return SimpleSAML_Session The session that is stored in the session handler, or null if the session wasn't
* @return SimpleSAML_Session|null The session that is stored in the session handler, or null if the session wasn't
* found.
*/
public static function getSession($sessionId = null)
......
......@@ -266,9 +266,8 @@ class SessionHandlerPHP extends SessionHandler
assert('is_string($session)');
$session = unserialize($session);
assert('$session instanceof SimpleSAML_Session');
return $session;
return ($session !== false) ? $session : null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment