Check if the column in the row is set for filters

When the column is not set for the filters undefined property exception is thrown in icinga-director. This is a quick fix to solve the issue.

(cherry picked from commit bbd36d5f83a29debbb4a72e79547ee7c4b35dbe0)
This commit is contained in:
Ravi Kumar Kempapura Srinivasa 2021-08-20 10:11:18 +02:00 committed by Johannes Meyer
parent 4aa22f1036
commit d66a21031c
4 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,10 @@ class FilterEqual extends FilterExpression
{
public function matches($row)
{
if (! isset($row->{$this->column})) {
return false;
}
return (string) $row->{$this->column} === (string) $this->expression;
}
}

View File

@ -7,6 +7,10 @@ class FilterEqualOrGreaterThan extends FilterExpression
{
public function matches($row)
{
if (! isset($row->{$this->column})) {
return false;
}
return (string) $row->{$this->column} >= (string) $this->expression;
}
}

View File

@ -17,6 +17,10 @@ class FilterEqualOrLessThan extends FilterExpression
public function matches($row)
{
if (! isset($row->{$this->column})) {
return false;
}
return (string) $row->{$this->column} <= (string) $this->expression;
}
}

View File

@ -17,6 +17,10 @@ class FilterLessThan extends FilterExpression
public function matches($row)
{
if (! isset($row->{$this->column})) {
return false;
}
return (string) $row->{$this->column} < (string) $this->expression;
}
}