From 4eb50972c301fe277a82009919428deecc12bada Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Thu, 4 Mar 2010 02:05:09 +0000 Subject: [PATCH] MINOR Fixed regression of Convert::json2obj() not working when json_decode() is being used git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100461 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/Convert.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/core/Convert.php b/core/Convert.php index 2bd86c2cf..85f2760ca 100755 --- a/core/Convert.php +++ b/core/Convert.php @@ -140,8 +140,7 @@ class Convert extends Object { } /** - * Uses the PHP 5.2 native json_encode function if available, - * otherwise falls back to the Services_JSON class. + * Convert an array into a JSON encoded string. * * @see http://pear.php.net/pepr/pepr-proposal-show.php?id=198 * @uses Director::baseFolder() @@ -161,8 +160,7 @@ class Convert extends Object { } /** - * Uses the PHP 5.2 native json_decode function if available, - * otherwise falls back to the Services_JSON class. + * Convert a JSON encoded string into an object. * * @see http://pear.php.net/pepr/pepr-proposal-show.php?id=198 * @uses Director::baseFolder() @@ -172,13 +170,9 @@ class Convert extends Object { * @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); } /**