Skip to content
Snippets Groups Projects
Commit 469ae91e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: regression

parent d5d4bc33
Branches
Tags
No related merge requests found
...@@ -72,8 +72,10 @@ function dol_json_encode($elements) ...@@ -72,8 +72,10 @@ function dol_json_encode($elements)
$output = '{'; $output = '{';
$last = $num - 1; $last = $num - 1;
$i = 0; $i = 0;
if (is_array($elements) && count($elements)>0) { $tmpelements=array();
foreach($elements as $key => $value) if (is_array($elements)) $tmpelements=$elements;
if (is_object($elements)) $tmpelements=get_object_vars($elements);
foreach($tmpelements as $key => $value)
{ {
$output .= '"'.$key.'":'; $output .= '"'.$key.'":';
if (is_array($value)) $output.= json_encode($value); if (is_array($value)) $output.= json_encode($value);
...@@ -81,7 +83,6 @@ function dol_json_encode($elements) ...@@ -81,7 +83,6 @@ function dol_json_encode($elements)
if ($i !== $last) $output.= ','; if ($i !== $last) $output.= ',';
++$i; ++$i;
} }
}
$output.= '}'; $output.= '}';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment