summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Raynor <chris@firebase.com>2014-06-25 14:15:09 -0700
committerChris Raynor <chris@firebase.com>2014-06-25 14:15:09 -0700
commitc5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2 (patch)
treea1c7d6cf401cd7d9d9e2dcce28a831f51c5223f0
parentc59b68dc87bf52d2d351368988492bd4c900cc3a (diff)
parent47fc8a335817834c6ac5b0030097e81468a4a06c (diff)
downloadphp-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.zip
php-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.tar.gz
php-jwt-c5e07e0c0e8f7c2b0f33f23482d6672eb7798ed2.tar.bz2
Merge branch 'master' into BambooHR-master
-rw-r--r--Authentication/JWT.php4
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);
}