Skip to content

Commit 050e59d

Browse files
authored
fix "Undefined array key" errors in various scripts (librenms#18412)
* fix Undefined array error Fixes error: PHP message: PHP Error(2): Undefined array key "note" in /opt/librenms/includes/html/forms/alert-notes.inc.php:30 * Fix Undefined array key "device" in syslog.inc.php Fixes "Undefined array key "device" in /opt/librenms/includes/html/pages/syslog.inc.php:21"
1 parent f5ee258 commit 050e59d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

includes/html/forms/alert-notes.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
$alert_id = $vars['alert_id'];
2929
$sub_type = $vars['sub_type'];
30-
$note = strip_tags($vars['note']) ?: '';
30+
$note = isset($vars['note']) ? strip_tags($vars['note']) : '';
3131
$status = 'error';
3232

3333
if (is_numeric($alert_id)) {

includes/html/pages/syslog.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
$no_refresh = true;
2020
$param = [];
21-
$device_id = (int) $vars['device'];
21+
$device_id = isset($vars['device']) ? (int) $vars['device'] : null;
2222

2323
if (isset($vars['action']) && $vars['action'] == 'expunge' && \Auth::user()->hasGlobalAdmin()) {
2424
\App\Models\Syslog::truncate();

0 commit comments

Comments
 (0)