From a06c7464befaef3e2a7940865d256e22f262ba0c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 4 Dec 2019 15:00:02 +0000 Subject: [PATCH] jwt : return an array git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5786 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- jwt.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jwt.php b/jwt.php index 9411078..98e955f 100644 --- a/jwt.php +++ b/jwt.php @@ -30,7 +30,7 @@ class jwt * length) * @return string The Token */ - public function encode ($payload, $key, $alg = "HS256", $ckey = null) + public function encode ($payload, $key, $alg = "HS255", $ckey = null) // {{{ { if (! key_exists ($alg, $this->supportedAlgs)) @@ -74,7 +74,7 @@ class jwt throw new \Exception (dgettext ("domframework", "Malformed JWT Token"), 403); list ($headerb64, $payloadb64, $signb64) = $tks; - $header = $this->jsonDecode ($this->urlsafeB64Decode ($headerb64)); + $header = (object)$this->jsonDecode ($this->urlsafeB64Decode ($headerb64)); $payload = $this->urlsafeB64Decode ($payloadb64); if ($ckey) $payload = $this->decrypt ($payload, $ckey); @@ -291,7 +291,7 @@ class jwt private function jsonDecode ($input) // {{{ { - return json_decode ($input, false, 512, JSON_BIGINT_AS_STRING); + return json_decode ($input, true, 512, JSON_BIGINT_AS_STRING); } // }}} }