From 51672374205ac4f67c1e9df50f9e59e73c53d00b Mon Sep 17 00:00:00 2001 From: Carlos Rodrigues Date: Fri, 7 Apr 2017 15:24:24 -0400 Subject: [PATCH] Set json_decode() JSON_BIGINT_AS_STRING flag to avoid int32 wrapping/saturation on large resource identifiers --- http.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http.php b/http.php index f78c87b..bae3e78 100644 --- a/http.php +++ b/http.php @@ -45,7 +45,9 @@ function request($method_uri, $query='', $payload='', &$response_headers=array() if ($http_status_code >= 400) throw new ResponseException($http_status_message, $http_status_code, $request, $response); - $msg_body = (false !== strpos($response_headers['content-type'], 'application/json')) ? json_decode($msg_body, true) : $msg_body; + if (false !== strpos($response_headers['content-type'], 'application/json')) { + return json_decode($msg_body, true, 512, JSON_BIGINT_AS_STRING); + } return $msg_body; }