From 812f6ad591e6b6d7d8983bb529da17d457d48d5c Mon Sep 17 00:00:00 2001 From: q Date: Sat, 19 May 2018 07:18:59 +0800 Subject: [PATCH] Escape control-characters in generated swagger When some table's description has `control-characters`, likes `\t` `\n`, swagger that generated by `/api.php` is a defective json --- api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api.php b/api.php index dd2a9bb..ee0769c 100644 --- a/api.php +++ b/api.php @@ -2367,7 +2367,7 @@ class PHP_CRUD_API { if ($i>0) echo ','; echo '{'; echo '"name":"'.$table['name'].'",'; - echo '"description":"'.$table['comments'].'"'; + echo '"description":'.json_encode($table['comments']); echo '}'; } echo '],';