From 1d3d075e3587f939e81e324e09ac6fedfe1a8839 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 4 Dec 2024 12:15:12 +0000 Subject: [PATCH] fix alert criteria parsing if only a single quoted phrase was adding a space to the front because explode was always returning an array with one entry. --- classes/Utility/Alert.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/Utility/Alert.php b/classes/Utility/Alert.php index fc85dccef8..6e87183132 100644 --- a/classes/Utility/Alert.php +++ b/classes/Utility/Alert.php @@ -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);