Skip to content

Fix #752: Dead $suspend_notify guard in ALERT>WARNING path - #797

Open
bmfmancini wants to merge 2 commits into
Cacti:developfrom
bmfmancini:fix/752-dead-suspend-notify-guard
Open

Fix #752: Dead $suspend_notify guard in ALERT>WARNING path#797
bmfmancini wants to merge 2 commits into
Cacti:developfrom
bmfmancini:fix/752-dead-suspend-notify-guard

Conversation

@bmfmancini

Copy link
Copy Markdown
Member

Summary

Fixes #752

Problem

In thold_functions.php, the Type 0 ALERT > WARNING elseif block is only reached when $notify was false in the prior warning block. The $suspend_notify variable is only ever set to true when $notify && $ra (the reset_ack re-alert suppression condition). Since $notify is false when this elseif path is entered, $suspend_notify is always false here.

This makes the guard if (!$suspend_notify && !$maint_dev) at the top of the ALERT>WARNING notification block structurally dead code — the suspend mechanism can never suppress notifications on this path.

Fix

Added an independent $suspend_notify evaluation for the ALERT>WARNING path, matching the pattern used in all other notification blocks (ALERT-only, WARNING-only, baseline, and time-based blocks). The $ra variable is already set earlier in the warning block and remains valid in the elseif, so the re-alert suppression now works correctly:

// If this is a realert and the operator has reset the ack, don't notify
if ($ra && $thold_data['reset_ack'] == 'on' && $thold_data['acknowledgment'] == '') {
    $suspend_notify = true;
} else {
    $suspend_notify = false;
}

Testing

  • Verified the change matches the pattern used in all 5 other notification blocks in the same function.
  • No new lint/compile errors introduced (pre-existing lint warnings unchanged).

The Type 0 ALERT>WARNING elseif block (thold_functions.php) was only
reached when  was false from the prior warning block. Since
 is only set to true when  && , the guard
'if (! && !)' was structurally dead code -
 was always false in this path.

This adds an independent  evaluation for the ALERT>WARNING
path, matching the pattern used in all other notification blocks, so the
suspend mechanism (reset_ack re-alert suppression) works correctly here.
Copilot AI lite review requested due to automatic review settings August 17, 2026 03:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Type 0 ALERT>WARNING block uses structurally dead $suspend_notify guard

2 participants