diff --git a/outputjson.php b/outputjson.php index 6b629f7..48871f7 100644 --- a/outputjson.php +++ b/outputjson.php @@ -4,7 +4,9 @@ @author Dominique Fournier */ require_once ("output.php"); -/** Display in JSOn the data provided */ +/** Display in JSON the data provided + * The data must NOT be binary ! + */ class outputjson extends output { /** Don't allow to output in JSON if the functions are not available in PHP */ @@ -25,7 +27,11 @@ class outputjson extends output @header('Cache-Control: post-check=0, pre-check=0', false); @header('Pragma: no-cache'); @header ("Content-Type: application/json"); - echo json_encode ($data); + $content = json_encode ($data); + if (json_last_error () !== 0) + printf (dgettext("domframework", "Can't send in JSON invalid data : %s"), + json_last_error_msg ()); + echo $content; if (!defined ("PHPUNIT")) exit; }