Skip to content

Commit

Permalink
fix: cast UserSession class from session object
Browse files Browse the repository at this point in the history
Signed-off-by: Thu Cao <thu.cao@amperecomputing.com>
  • Loading branch information
thcao-ampere committed Jul 1, 2024
1 parent 3005fe2 commit 2898946
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2898946

Please sign in to comment.