Fix php 7.2 compatibility
This commit is contained in:
parent
9523bf5fbd
commit
fe1ce5b3ac
@ -42,19 +42,21 @@ if (! function_exists('json_encode'))
|
|||||||
*
|
*
|
||||||
* @param mixed $elements PHP Object to json encode
|
* @param mixed $elements PHP Object to json encode
|
||||||
* @return string Json encoded string
|
* @return string Json encoded string
|
||||||
* @deprecated PHP >= 5.3 supports native json_encode
|
|
||||||
* @see json_encode()
|
* @see json_encode()
|
||||||
*/
|
*/
|
||||||
function dol_json_encode($elements)
|
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=count($elements);
|
$num=0;
|
||||||
if (is_object($elements)) // Count number of properties for an object
|
if (is_object($elements)) // Count number of properties for an object
|
||||||
{
|
{
|
||||||
$num=0;
|
|
||||||
foreach($elements as $key => $value) $num++;
|
foreach($elements as $key => $value) $num++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$num=count($elements);
|
||||||
|
}
|
||||||
//var_dump($num);
|
//var_dump($num);
|
||||||
|
|
||||||
// determine type
|
// determine type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user