Add warning to warn against json emulation

This commit is contained in:
Laurent Destailleur 2017-09-04 13:22:21 +02:00
parent 9304df21a0
commit 8de51ede18

View File

@ -19,14 +19,14 @@
/**
* \file htdocs/core/lib/json.lib.php
* \brief Functions to emulate json function for PHP < 5.3 compatibility
* \brief Functions to emulate json function when there were not activated
* \ingroup core
*/
if (! function_exists('json_encode'))
{
/**
* Implement json_encode for PHP that does not support it
* Implement json_encode for PHP that does not have module enabled.
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
@ -42,12 +42,11 @@ if (! function_exists('json_encode'))
*
* @param mixed $elements PHP Object to json encode
* @return string Json encoded string
* @deprecated PHP >= 5.3 supports native json_encode
* @see json_encode()
*/
function dol_json_encode($elements)
{
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING);
dol_syslog("For better permorfance, enable the native json in your PHP", LOG_WARNING);
$num=0;
if (is_object($elements)) // Count number of properties for an object