diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index 8c2d8c33a9774..ad45303fa7c3b 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -184,7 +184,7 @@ public function getTokenById(int $tokenId): IToken { throw new InvalidTokenException(); } - if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) { + if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { throw new ExpiredTokenException($token); } diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index 73bd7a711dca2..fe352d29e056f 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -80,7 +80,7 @@ public function getToken(string $tokenId): IToken { throw new InvalidTokenException(); } - if ($token->getExpires() !== null && $token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { + if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { throw new ExpiredTokenException($token); } @@ -94,7 +94,7 @@ public function getTokenById(int $tokenId): IToken { throw new InvalidTokenException(); } - if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) { + if ((int)$token->getExpires() !== 0 && $token->getExpires() < $this->time->getTime()) { throw new ExpiredTokenException($token); }