Skip to content
Snippets Groups Projects
Commit 941ac88a authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Add magic methods for Session

parent 2cea1562
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ use SimpleSAML\Utils;
* @package SimpleSAMLphp
*/
class Session implements Serializable, Utils\ClearableState
class Session implements Utils\ClearableState
{
/**
* This is a timeout value for setData, which indicates that the data
......@@ -200,15 +200,15 @@ class Session implements Serializable, Utils\ClearableState
/**
* Serialize this session object.
* Serialize this XML chunk.
*
* This method will be invoked by any calls to serialize().
*
* @return string The serialized representation of this session object.
* @return array The serialized representation of this XML object.
*/
public function serialize(): string
public function __serialize(): array
{
return serialize(get_object_vars($this));
return get_object_vars($this);
}
......@@ -218,18 +218,13 @@ class Session implements Serializable, Utils\ClearableState
* This method will be invoked by any calls to unserialize(), allowing us to restore any data that might not
* be serializable in its original form (e.g.: DOM objects).
*
* @param string $serialized The serialized representation of a session that we want to restore.
*
* Cannot typehint param as string due to upstream restrictions
* @param array $serialized The serialized representation of a session that we want to restore.
*/
public function unserialize($serialized): void
public function __unserialize($serialized): void
{
$session = unserialize($serialized);
if (is_array($session)) {
foreach ($session as $k => $v) {
foreach ($serialized as $k => $v) {
$this->$k = $v;
}
}
self::$config = Configuration::getInstance();
// look for any raw attributes and load them in the 'Attributes' array
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment