diff options
author | Neuman Vong <neuman@twilio.com> | 2011-04-27 17:16:15 -0700 |
---|---|---|
committer | Neuman Vong <neuman@twilio.com> | 2011-04-27 17:16:15 -0700 |
commit | 6fc8c26b54ebb7f5e81a14b5b65fa09995fe1cb1 (patch) | |
tree | 966a8a701a29c357df5b76beeced00beaf869ec3 | |
parent | 45e376552e8dddea150d5548412f089ca32c0b3a (diff) | |
download | php-jwt-6fc8c26b54ebb7f5e81a14b5b65fa09995fe1cb1.zip php-jwt-6fc8c26b54ebb7f5e81a14b5b65fa09995fe1cb1.tar.gz php-jwt-6fc8c26b54ebb7f5e81a14b5b65fa09995fe1cb1.tar.bz2 |
Stop padding inputs already divisible by 4
-rw-r--r-- | JWT.php | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -127,8 +127,11 @@ class JWT */ public static function urlsafeB64Decode($input) { - $padlen = 4 - strlen($input) % 4; - $input .= str_repeat('=', $padlen); + $remainder = strlen($input) % 4; + if ($remainder) { + $padlen = 4 - $remainder; + $input .= str_repeat('=', $padlen); + } return base64_decode(strtr($input, '-_', '+/')); } |