From 6bae7d020c80c5c3ff0f64a38bc1690f362b53a2 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 23 Jul 2016 14:16:06 -0700 Subject: [PATCH] Call json_decode() without $options parameter in PHP versions less than 5.4.0 --- src/Curl/Curl.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 39842a6..a34494b 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -759,6 +759,14 @@ class Curl $args = func_get_args(); $this->jsonDecoder = function($response) use ($args) { array_unshift($args, $response); + + // Call json_decode() without the $options parameter in PHP + // versions less than 5.4.0 as the $options parameter was added in + // PHP version 5.4.0. + if (version_compare(PHP_VERSION, '5.4.0', '<')) { + $args = array_slice($args, 0, 3); + } + $json_obj = call_user_func_array('json_decode', $args); if (!($json_obj === null)) { $response = $json_obj;