From 881267d829a162612a66f0364e33be1d37b7329b Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 29 Apr 2016 10:33:26 +0200 Subject: [PATCH] =?UTF-8?q?ThresholdRange::fromString():=20default=20to=20?= =?UTF-8?q?-=E2=88=9E:=E2=88=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs #8194 --- modules/monitoring/library/Monitoring/Plugin/Perfdata.php | 4 ++-- .../monitoring/library/Monitoring/Plugin/ThresholdRange.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php index 559e2a703..6c2d89a72 100644 --- a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php +++ b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php @@ -323,14 +323,14 @@ class Perfdata case 3: $this->rawCriticalThreshold = trim($parts[2]); $this->criticalThreshold = self::convert( - ThresholdRange::fromString($this->rawCriticalThreshold ?: '~:'), + ThresholdRange::fromString($this->rawCriticalThreshold), $this->unit ); // Fallthrough case 2: $this->rawWarningThreshold = trim($parts[1]); $this->warningThreshold = self::convert( - ThresholdRange::fromString($this->rawWarningThreshold ?: '~:'), + ThresholdRange::fromString($this->rawWarningThreshold), $this->unit ); } diff --git a/modules/monitoring/library/Monitoring/Plugin/ThresholdRange.php b/modules/monitoring/library/Monitoring/Plugin/ThresholdRange.php index 26165c0e9..536dc8f7a 100644 --- a/modules/monitoring/library/Monitoring/Plugin/ThresholdRange.php +++ b/modules/monitoring/library/Monitoring/Plugin/ThresholdRange.php @@ -36,10 +36,14 @@ class ThresholdRange * * @return ThresholdRange */ - public static function fromString($rawRange) + public static function fromString($rawRange = '') { $range = new static(); + if ($rawRange === '') { + return $range; + } + $rawRange = ltrim($rawRange); if (substr($rawRange, 0, 1) === '@') { $range->setInverted();