Skip to content

Commit 3986874

Browse files
authored
Merge branch 'main' into Allow-empty-string-kid-as-valid-kid
2 parents 42df17f + 43d70ae commit 3986874

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [6.11.1](https://github.com/firebase/php-jwt/compare/v6.11.0...v6.11.1) (2025-04-09)
4+
5+
6+
### Bug Fixes
7+
8+
* update error text for consistency ([#528](https://github.com/firebase/php-jwt/issues/528)) ([c11113a](https://github.com/firebase/php-jwt/commit/c11113afa13265e016a669e75494b9203b8a7775))
9+
310
## [6.11.0](https://github.com/firebase/php-jwt/compare/v6.10.2...v6.11.0) (2025-01-23)
411

512

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ $jwks = ['keys' => []];
291291

292292
// JWK::parseKeySet($jwks) returns an associative array of **kid** to Firebase\JWT\Key
293293
// objects. Pass this as the second parameter to JWT::decode.
294-
JWT::decode($payload, JWK::parseKeySet($jwks));
294+
JWT::decode($jwt, JWK::parseKeySet($jwks));
295295
```
296296

297297
Using Cached Key Sets
@@ -350,7 +350,7 @@ use InvalidArgumentException;
350350
use UnexpectedValueException;
351351

352352
try {
353-
$decoded = JWT::decode($payload, $keys);
353+
$decoded = JWT::decode($jwt, $keys);
354354
} catch (InvalidArgumentException $e) {
355355
// provided key/key-array is empty or malformed.
356356
} catch (DomainException $e) {
@@ -380,7 +380,7 @@ like this:
380380
use Firebase\JWT\JWT;
381381
use UnexpectedValueException;
382382
try {
383-
$decoded = JWT::decode($payload, $keys);
383+
$decoded = JWT::decode($jwt, $keys);
384384
} catch (LogicException $e) {
385385
// errors having to do with environmental setup or malformed JWT Keys
386386
} catch (UnexpectedValueException $e) {
@@ -395,7 +395,7 @@ instead, you can do the following:
395395

396396
```php
397397
// return type is stdClass
398-
$decoded = JWT::decode($payload, $keys);
398+
$decoded = JWT::decode($jwt, $keys);
399399

400400
// cast to array
401401
$decoded = json_decode(json_encode($decoded), true);

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
$ex = 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::ATOM, (int) floor($payload->nbf))
158158
);
159159
$ex->setPayload($payload);
160160
throw $ex;
@@ -165,7 +165,7 @@ public static function decode(
165165
// correctly used the nbf claim).
166166
if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > ($timestamp + static::$leeway)) {
167167
$ex = new BeforeValidException(
168-
'Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, (int) $payload->iat)
168+
'Cannot handle token with iat prior to ' . \date(DateTime::ATOM, (int) floor($payload->iat))
169169
);
170170
$ex->setPayload($payload);
171171
throw $ex;

0 commit comments

Comments
 (0)