diff --git a/LibreNMS/Alert/Transport/Dummy.php b/LibreNMS/Alert/Transport/Dummy.php index a3c8c5291f..7dc995e927 100644 --- a/LibreNMS/Alert/Transport/Dummy.php +++ b/LibreNMS/Alert/Transport/Dummy.php @@ -40,6 +40,9 @@ class Dummy extends Transport public static function configTemplate() { - return []; + return [ + 'validation' => [], + 'config' => [], + ]; } } diff --git a/includes/html/forms/alert-transports.inc.php b/includes/html/forms/alert-transports.inc.php index 77131dc2b1..b3924a9e3e 100644 --- a/includes/html/forms/alert-transports.inc.php +++ b/includes/html/forms/alert-transports.inc.php @@ -91,29 +91,23 @@ if (empty($name)) { } $status = 'error'; } else { - $transport_config = json_decode(dbFetchCell('SELECT transport_config FROM alert_transports WHERE transport_id=?', [$transport_id]), true); + $transport_config = (array)json_decode(dbFetchCell('SELECT transport_config FROM alert_transports WHERE transport_id=?', [$transport_id]), true); foreach ($result['config'] as $tmp_config) { if (isset($tmp_config['name']) && $tmp_config['type'] !== 'hidden') { $transport_config[$tmp_config['name']] = $vars[$tmp_config['name']]; } } //Update the json config field - if ($transport_config) { - $transport_config = json_encode($transport_config); - $detail = [ - 'transport_type' => $transport_type, - 'transport_config' => $transport_config - ]; - $where = 'transport_id=?'; + $detail = [ + 'transport_type' => $transport_type, + 'transport_config' => json_encode($transport_config) + ]; + $where = 'transport_id=?'; - dbUpdate($detail, 'alert_transports', $where, [$transport_id]); + dbUpdate($detail, 'alert_transports', $where, [$transport_id]); - $status = 'ok'; - $message = 'Updated alert transports'; - } else { - $status = 'error'; - $message = 'There was an issue with the transport config'; - } + $status = 'ok'; + $message = 'Updated alert transports'; } if ($status == 'error' && $newEntry) { //If error, we will have to delete the new entry in alert_transports tbl