Skip to content

Commit

Permalink
Fix: regression
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed May 22, 2013
1 parent d5d4bc3 commit 469ae91
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions htdocs/core/lib/json.lib.php
Expand Up @@ -72,15 +72,16 @@ function dol_json_encode($elements)
$output = '{';
$last = $num - 1;
$i = 0;
if (is_array($elements) && count($elements)>0) {
foreach($elements as $key => $value)
{
$output .= '"'.$key.'":';
if (is_array($value)) $output.= json_encode($value);
else $output .= _val($value);
if ($i !== $last) $output.= ',';
++$i;
}
$tmpelements=array();
if (is_array($elements)) $tmpelements=$elements;
if (is_object($elements)) $tmpelements=get_object_vars($elements);
foreach($tmpelements as $key => $value)
{
$output .= '"'.$key.'":';
if (is_array($value)) $output.= json_encode($value);
else $output .= _val($value);
if ($i !== $last) $output.= ',';
++$i;
}
$output.= '}';
}
Expand Down

0 comments on commit 469ae91

Please sign in to comment.