Skip to content

Commit

Permalink
Fix occasional TypeError
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Jul 8, 2024
1 parent 92cae6e commit 9f43649
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion web/lib/MRBS/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,17 @@ private static function storeToken($token) : void

private static function getStoredToken() : ?string
{
return session()->get(self::TOKEN_NAME);
$result = session()->get(self::TOKEN_NAME);

// For some unknown reason the integer value 0 is sometimes stored in the session
// variable. It's not clear how this can happen.
if (isset($result) && !is_string($result))
{
trigger_error("Stored token is of type " . gettype($result) . ", value $result", E_USER_WARNING);
$result = strval($result);
}

return $result;
}


Expand Down

0 comments on commit 9f43649

Please sign in to comment.