diff options
author | Chris Raynor <chris@firebase.com> | 2014-06-25 14:15:09 -0700 |
---|---|---|
committer | Chris Raynor <chris@firebase.com> | 2014-06-25 14:15:09 -0700 |
commit | c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2 (patch) | |
tree | a1c7d6cf401cd7d9d9e2dcce28a831f51c5223f0 | |
parent | c59b68dc87bf52d2d351368988492bd4c900cc3a (diff) | |
parent | 47fc8a335817834c6ac5b0030097e81468a4a06c (diff) | |
download | php-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.zip php-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.tar.gz php-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.tar.bz2 |
Merge branch 'master' into BambooHR-master
-rw-r--r-- | Authentication/JWT.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Authentication/JWT.php b/Authentication/JWT.php index 4145869..38a4f7e 100644 --- a/Authentication/JWT.php +++ b/Authentication/JWT.php @@ -171,7 +171,7 @@ class JWT */ public static function jsonDecode($input) { - if (version_compare(PHP_VERSION, '5.4.0', '>=') && defined('JSON_BIGINT_AS_STRING')) { + if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) { /* In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you to specify that large ints (like Steam * Transaction IDs) should be treated as strings, rather than the PHP default behaviour of converting them to floats. */ @@ -181,7 +181,7 @@ class JWT * string and quote them (thus converting them to strings) before decoding, hence the preg_replace() call. */ $max_int_length = strlen((string) PHP_INT_MAX) - 1; - $json_without_bigints = preg_replace('/:\s*(\d{'.$max_int_length.',})/', ': "$1"', $input); + $json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input); $obj = json_decode($json_without_bigints); } |