summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Stamp <github@timstamp.co.uk>2016-12-12 12:14:10 +0000
committerGitHub <noreply@github.com>2016-12-12 12:14:10 +0000
commit491ab3a80566cd1427549994ee7a07d9154311c4 (patch)
treebde8ce344d0fd57764e8d6c719a4df9e894ad147 /src
parent3aa3d978973f080746b2f2f75b10d3f38cbb0557 (diff)
downloadphp-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.php3
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');