]> git.joonet.de Git - adminer.git/commitdiff
Tabs must also be escaped in JSON strings
authorJanne Cederberg <janne.cederberg@gmail.com>
Thu, 7 Jul 2016 12:34:59 +0000 (15:34 +0300)
committerJakub Vrana <jakub@vrana.cz>
Sat, 18 Feb 2017 16:51:55 +0000 (17:51 +0100)
If database table data contains tab characters (0x09) then those
must also be escaped along with newlines and carriage returns for
the resulting JSON file to be valid.

adminer/include/functions.inc.php

index 8b97138d15aff35bf8c61ddc086b8a541eac2baa..9756cd917327ca1be4ca9b864cb1702c6925a13d 100644 (file)
@@ -243,7 +243,7 @@ function json_row($key, $val = null) {
                echo "{";
        }
        if ($key != "") {
-               echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
+               echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
                $first = false;
        } else {
                echo "\n}\n";