Skip to content

Bug: Type 2 normal restoral conditions inverted — fires for un-triggered thresholds #746

Description

@somethingwithproof

Summary

In thold_functions.php, the type 2 (time-based) normal restoral logic in thold_check_threshold() (lines ~3443 and ~3512) used < instead of >= for the fail count comparisons:

// Warning restoral (inverted):
if ($alertstat != 0 && $warning_failures < $warning_trigger && $thold_data['restored_alert'] != 'on') {

// Alert restoral (inverted):
} elseif ($alertstat != 0 && $failures < $trigger && $thold_data['restored_alert'] != 'on') {

Impact

The < vs >= inversion caused:

  • Restorals to fire for thresholds that were never triggered — when the fail count was below the trigger (no alert was ever sent), a restoral notification was incorrectly generated.
  • Restorals to be silently suppressed for thresholds that were triggered — when the fail count reached or exceeded the trigger (an alert was sent), the restoral was incorrectly blocked.

Fix

Implementation in #796.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions