When the $show variable is false or null the condition for !$show == all will always evaluate to true. (#7617)

The call to action_name with $destination_app_data empty (no action for destination number) will cause a PHP warning.
This commit is contained in:
frytimo
2025-11-16 00:28:52 -04:00
committed by GitHub
parent 41daacf090
commit 5f1b34a194

View File

@@ -231,26 +231,21 @@
unset($sql, $parameters);
//update the array to add the actions
if (!$show == "all") {
if ($show != "all") {
$x = 0;
foreach ($destinations as $row) {
$destinations[$x]['actions'] = '';
if (!empty($row['destination_actions'])) {
//prepare the destination actions
if (!empty(json_decode($row['destination_actions'], true))) {
//add the actions to the array
$destination_app_data = [];
foreach (json_decode($row['destination_actions'], true) as $action) {
$destination_app_data[] = $action['destination_app'].':'.$action['destination_data'];
}
$actions = action_name($destination_array, $destination_app_data);
$destinations[$x]['actions'] = (!empty($actions)) ? implode(', ', $actions) : '';
}
//add the actions to the array
$actions = action_name($destination_array, $destination_app_data);
$destinations[$x]['actions'] = (!empty($actions)) ? implode(', ', $actions) : '';
//empty the array before the next iteration
unset($destination_app_data);
}
else {
$destinations[$x]['actions'] = '';
}
$x++;
}