Merge branch 'json_encode_fail_branch' into 'nightly'

output error if json_encode fails



See merge request !86
This commit is contained in:
mmn 2016-01-26 21:16:24 +00:00
commit 52778e1882

View File

@ -771,9 +771,15 @@ class ApiAction extends Action
function showJsonObjects($objects)
{
print(json_encode($objects));
$json_objects = json_encode($objects);
if($json_objects === false) {
$this->clientError(_('JSON encoding failed. Error: ').json_last_error_msg());
} else {
print $json_objects;
}
}
function showSingleXmlStatus($notice)
{
$this->initDocument('xml');
@ -1558,4 +1564,4 @@ class ApiAction extends Action
return $uri;
}
}
}