diff options
author | Tim Stamp <github@timstamp.co.uk> | 2016-12-12 12:14:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 12:14:10 +0000 |
commit | 491ab3a80566cd1427549994ee7a07d9154311c4 (patch) | |
tree | bde8ce344d0fd57764e8d6c719a4df9e894ad147 /src | |
parent | 3aa3d978973f080746b2f2f75b10d3f38cbb0557 (diff) | |
download | php-jwt-491ab3a80566cd1427549994ee7a07d9154311c4.zip php-jwt-491ab3a80566cd1427549994ee7a07d9154311c4.tar.gz php-jwt-491ab3a80566cd1427549994ee7a07d9154311c4.tar.bz2 |
bugfix: 'kid' not in given key list
if 'kid' value is not found in the given key map, should throw an exception.
Instead, it was outputting a php warning for using an undefined index, resulting in a null key.
Diffstat (limited to 'src')
-rw-r--r-- | src/JWT.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/JWT.php b/src/JWT.php index 6d30e94..8170dba 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -98,6 +98,9 @@ class JWT } if (is_array($key) || $key instanceof \ArrayAccess) { if (isset($header->kid)) { + if(!isset($key[$header->kid])) { + throw new UnexpectedValueException('"kid" not found in key map, unable to lookup correct key'); + } $key = $key[$header->kid]; } else { throw new UnexpectedValueException('"kid" empty, unable to lookup correct key'); |