Skip to content

Commit 4935639

Browse files
committed
Update error text for consistency
When these errors are triggered, the value being validated may be different from the value reported in the error message. This fixes that inconsistency.
1 parent 5dbc895 commit 4935639

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JWT.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static function decode(
154154
// token can actually be used. If it's not yet that time, abort.
155155
if (isset($payload->nbf) && floor($payload->nbf) > ($timestamp + static::$leeway)) {
156156
throw new BeforeValidException(
157-
'Cannot handle token with nbf prior to ' . \date(DateTime::ISO8601, (int) $payload->nbf)
157+
'Cannot handle token with nbf prior to ' . \date(DateTime::ISO8601, floor($payload->nbf))
158158
);
159159
}
160160

@@ -163,7 +163,7 @@ public static function decode(
163163
// correctly used the nbf claim).
164164
if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > ($timestamp + static::$leeway)) {
165165
throw new BeforeValidException(
166-
'Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, (int) $payload->iat)
166+
'Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, floor($payload->iat))
167167
);
168168
}
169169

0 commit comments

Comments
 (0)