Fix: use the original json functions

This commit is contained in:
Regis Houssin
2012-03-18 19:59:38 +01:00
parent ed41e03589
commit 4ecc64504d
13 changed files with 13 additions and 45 deletions

View File

@@ -145,38 +145,6 @@ if (! function_exists('json_decode'))
}
}
/**
* Function that encodes data in json format.
* TODO Remove this function because the json_encode is already redesigned by dolibarr function and
* this functions was designed for compatibility between an instable 3.2 version with final 3.2 version. We must
* manage compatibility only between 2 stable versions.
*
* @param mixed $elements PHP object to json encode
* @return string Json encoded string
*/
function dol_json_encode($elements)
{
return json_encode($elements); // This function is redesigned into functions.lib.php
}
/**
* Function that decodes data from json format
* TODO Remove this function because the json_encode is already redesigned by dolibarr function and
* this functions was designed for compatibility between an instable 3.2 version with final 3.2 version. We must
* manage compatibility only between 2 stable versions.
*
* @param string $json Json encoded to PHP Object or Array
* @param bool $assoc False return an object, true return an array
* @return mixed Object or Array
*/
function dol_json_decode($json, $assoc=false)
{
$out='';
$out = @unserialize($json); // For compatibility, test if serialized
if (empty($out)) $out = json_decode($json, $assoc); // This function is redesigned into functions.lib.php
return $out;
}
/**
* Function to return value of a static property when class
* name is dynamically defined (not hard coded).