From 2898946a8eaf37f8b84e9b732760c3f8930c1cd6 Mon Sep 17 00:00:00 2001 From: Thu Cao Date: Sat, 29 Jun 2024 00:25:02 -0600 Subject: [PATCH] fix: cast UserSession class from session object Signed-off-by: Thu Cao --- lib/Server/Server.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Server/Server.php b/lib/Server/Server.php index b9a66bcee..3a8a3987a 100644 --- a/lib/Server/Server.php +++ b/lib/Server/Server.php @@ -210,7 +210,15 @@ public function GetUserSession() $userSession = $this->GetSession(SessionKeys::USER_SESSION); if (!empty($userSession)) { - return $userSession; + // return (UserSession) $userSession; + $class = 'UserSession'; + return unserialize( + preg_replace( + '/^O:\d+:"[^"]++"/', + 'O:'.strlen($class).':"'.$class.'"', + serialize($userSession) + ) + ); } return new NullUserSession();