mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
-fix: handle incorrect json in settings
This commit is contained in:
parent
47972dce05
commit
80f19f936c
1 changed files with 3 additions and 3 deletions
|
|
@ -218,13 +218,13 @@ class Config
|
|||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function requestDomain(string $key)
|
||||
public static function requestDomain(string $key): array
|
||||
{
|
||||
$db = DBConnection::instance();
|
||||
$json = $db->sq("SELECT param_value FROM {$db->prefix}settings WHERE param_key = ?", array($key));
|
||||
if (!$json) return array();
|
||||
$j = json_decode($json, true, 100, JSON_INVALID_UTF8_SUBSTITUTE);
|
||||
if ($j === false) {
|
||||
if ($j === null) {
|
||||
error_log("MTT Error: Failed to decode JSON object with settings. Code: ". (int)json_last_error());
|
||||
return array();
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ class Config
|
|||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function requestDefaultDomain()
|
||||
public static function requestDefaultDomain(): array
|
||||
{
|
||||
return self::requestDomain('config.json');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue