From afe46f819f7671469a5eb3fd0bd432415ac5f421 Mon Sep 17 00:00:00 2001 From: Sean Mancini Date: Thu, 5 Nov 2026 23:46:23 -0500 Subject: [PATCH] fix: pass each trigger command its own text in thold_set_environ() (#760) The low and normal branches of thold_command_execution() passed trigger_cmd_high to thold_set_environ(). thold_set_environ() does not currently read its $text argument (it exports the same THOLD_* variables whatever it is given), so this changes nothing at runtime, but each branch now passes the command it is about to run, and a future change that does use $text will not silently get the high command. All three branches are already exercised by TholdCommandExecutionTest's breach-direction cases. --- includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 1504bac3..f96df639 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -5315,7 +5315,7 @@ function thold_command_execution(&$thold_data, &$h, $breach_up, $breach_down, $b $cmd = thold_replace_threshold_tags($cmd, $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name, true, $deferred); $cmd = strtr($cmd, $deferred); - $environment = thold_set_environ($thold_data['trigger_cmd_high'], $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name); + $environment = thold_set_environ($thold_data['trigger_cmd_low'], $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name); if ($queue == 'on') { $data = [ @@ -5337,7 +5337,7 @@ function thold_command_execution(&$thold_data, &$h, $breach_up, $breach_down, $b $cmd = thold_replace_threshold_tags($cmd, $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name, true, $deferred); $cmd = strtr($cmd, $deferred); - $environment = thold_set_environ($thold_data['trigger_cmd_high'], $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name); + $environment = thold_set_environ($thold_data['trigger_cmd_norm'], $thold_data, $h, $thold_data['lastread'], $thold_data['local_graph_id'], $data_source_name); if ($queue == 'on') { $data = [