[icinga-checkins] icinga.org: icingaweb2/feature/livestatus-playground-4787: Filters: try to give meaningful results for...

git at icinga.org git at icinga.org
Tue Nov 11 19:32:35 CET 2014


Module: icingaweb2
Branch: feature/livestatus-playground-4787
Commit: 6d705721e3fbae7987b655bb51bd76d7c4d46b6d
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=6d705721e3fbae7987b655bb51bd76d7c4d46b6d

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Nov 11 19:26:37 2014 +0100

Filters: try to give meaningful results for...

...missing columns

refs #4787

---

 library/Icinga/Data/Filter/FilterGreaterThan.php |    5 ++++-
 library/Icinga/Data/Filter/FilterMatch.php       |    4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/library/Icinga/Data/Filter/FilterGreaterThan.php b/library/Icinga/Data/Filter/FilterGreaterThan.php
index bda8665..62ba16f 100644
--- a/library/Icinga/Data/Filter/FilterGreaterThan.php
+++ b/library/Icinga/Data/Filter/FilterGreaterThan.php
@@ -6,9 +6,12 @@ namespace Icinga\Data\Filter;
 
 class FilterGreaterThan extends FilterExpression
 {
-
     public function matches($row)
     {
+        if (! isset($row->{$this->column})) {
+            // TODO: REALLY? Exception?
+            return false;
+        }
         return (string) $row->{$this->column} > (string) $this->expression;
     }
 }
diff --git a/library/Icinga/Data/Filter/FilterMatch.php b/library/Icinga/Data/Filter/FilterMatch.php
index ef3cad8..159feb0 100644
--- a/library/Icinga/Data/Filter/FilterMatch.php
+++ b/library/Icinga/Data/Filter/FilterMatch.php
@@ -8,6 +8,10 @@ class FilterMatch extends FilterExpression
 {
     public function matches($row)
     {
+        if (! isset($row->{$this->column})) {
+            // TODO: REALLY? Exception?
+            return false;
+        }
         $expression = (string) $this->expression;
         if (strpos($expression, '*') === false) {
             return (string) $row->{$this->column} === $expression;



More information about the icinga-checkins mailing list