Skip to content

Commit c5e07e0

Browse files
author
Chris Raynor
committed
Merge branch 'master' into BambooHR-master
2 parents c59b68d + 47fc8a3 commit c5e07e0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Authentication/JWT.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static function verify($msg, $signature, $key, $method = 'HS256') {
171171
*/
172172
public static function jsonDecode($input)
173173
{
174-
if (version_compare(PHP_VERSION, '5.4.0', '>=') && defined('JSON_BIGINT_AS_STRING')) {
174+
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
175175
/* In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you to specify that large ints (like Steam
176176
* Transaction IDs) should be treated as strings, rather than the PHP default behaviour of converting them to floats.
177177
*/
@@ -181,7 +181,7 @@ public static function jsonDecode($input)
181181
* string and quote them (thus converting them to strings) before decoding, hence the preg_replace() call.
182182
*/
183183
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
184-
$json_without_bigints = preg_replace('/:\s*(\d{'.$max_int_length.',})/', ': "$1"', $input);
184+
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
185185
$obj = json_decode($json_without_bigints);
186186
}
187187

0 commit comments

Comments
 (0)