mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
- fix possible error if failed to create json object with init options
This commit is contained in:
parent
a51d0af843
commit
c45e6c6bef
1 changed files with 8 additions and 1 deletions
|
|
@ -82,5 +82,12 @@ function js_options()
|
|||
"autotag" => Config::get('autotag') ? true : false,
|
||||
"markdown" => Config::get('markup') == 'v1' ? false : true
|
||||
);
|
||||
echo json_encode($a, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
$json = json_encode($a, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
if ($json === false) {
|
||||
error_log("MTT Error: Failed to encode array of options to JSON. Code: ". (int)json_last_error());
|
||||
echo "{}";
|
||||
}
|
||||
else {
|
||||
echo $json;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue