diff --git a/core/Convert.php b/core/Convert.php index 965f7f103..0be48ac7d 100644 --- a/core/Convert.php +++ b/core/Convert.php @@ -170,13 +170,9 @@ class Convert { * @return mixed JSON safe string */ static function json2obj($val) { - if(function_exists('json_decode')) { - return json_decode($val); - } else { - require_once(Director::baseFolder() . '/sapphire/thirdparty/json/JSON.php'); - $json = new Services_JSON(); - return $json->decode($val); - } + require_once(Director::baseFolder() . '/sapphire/thirdparty/json/JSON.php'); + $json = new Services_JSON(); + return $json->decode($val); } /** @@ -187,19 +183,15 @@ class Convert { * @return array|boolean */ static function json2array($val) { - if(function_exists('json_decode')) { - return json_decode($val, true); - } else { - $json = self::json2obj($val); - if(!$json) return false; - - $arr = array(); - foreach($json as $k => $v) { - $arr[$k] = $v; - } - - return $arr; + $json = self::json2obj($val); + if(!$json) return false; + + $arr = array(); + foreach($json as $k => $v) { + $arr[$k] = $v; } + + return $arr; } /**