Skip to content

Commit

Permalink
fix alert criteria parsing if only a single quoted phrase
Browse files Browse the repository at this point in the history
was adding a space to the front because explode was always returning an
array with one entry.
  • Loading branch information
struan committed Dec 4, 2024
1 parent 5638cfa commit 1d3d075
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/Utility/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ public static function prettifyCriteria($alert_criteria, $as_parts = false) {
$alert_criteria = trim(preg_replace('/ +/', ' ', str_replace($phrases[0], "", $alert_criteria)));

# and then create an array with the words and phrases
$criteria = explode(' ', $alert_criteria);
$criteria = [];
if ( $alert_criteria != "") {
$criteria = explode(' ', $alert_criteria);
}
$criteria = array_merge($criteria, $phrases[1]);
} else {
$criteria = explode(' ', $alert_criteria);
Expand Down

0 comments on commit 1d3d075

Please sign in to comment.