JwtUtils: fix phpstan failure

This commit is contained in:
Dylan K. Taylor 2020-05-06 22:00:11 +01:00
parent 0b6d6306cf
commit a6c35cab9a

View File

@ -36,12 +36,7 @@ final class JwtUtils{
if(count($v) !== 3){
throw new \UnexpectedValueException("Expected exactly 3 JWT parts, got " . count($v));
}
$payloadB64 = $v[1];
$payloadJSON = self::b64UrlDecode($payloadB64);
if($payloadJSON === false){
throw new \UnexpectedValueException("Invalid base64 JWT payload");
}
$result = json_decode($payloadJSON, true);
$result = json_decode(self::b64UrlDecode($v[1]), true);
if(!is_array($result)){
throw new \UnexpectedValueException("Failed to decode JWT payload JSON: " . json_last_error_msg());
}