diff --git a/library/Icinga/Data/Filter/Filter.php b/library/Icinga/Data/Filter/Filter.php index 8a063ee2a6..866d161b83 100644 --- a/library/Icinga/Data/Filter/Filter.php +++ b/library/Icinga/Data/Filter/Filter.php @@ -132,7 +132,7 @@ public static function where($col, $filter) public static function expression($col, $op, $expression) { $col = trim($col); - $expression = trim($expression); + $expression = is_array($expression) ? array_map('trim', $expression) : trim($expression); switch ($op) { case '=': return new FilterMatch($col, $op, $expression); case '<': return new FilterLessThan($col, $op, $expression); diff --git a/test/php/library/Icinga/Data/Filter/FilterTest.php b/test/php/library/Icinga/Data/Filter/FilterTest.php index b8f9ea78a9..7d63492137 100644 --- a/test/php/library/Icinga/Data/Filter/FilterTest.php +++ b/test/php/library/Icinga/Data/Filter/FilterTest.php @@ -204,9 +204,11 @@ public function testLeadingAndTrailingWhitespacesSanitizing() $columnHasWhitespaces = Filter::where(' host ', 'localhost'); $expressionHasWhitespaces = Filter::where('host', ' localhost '); $bothHaveWhitespaces = Filter::fromQueryString(' host = localhost '); + $withArray = Filter::where(' host ', array(' no match ', ' localhost ')); $this->assertTrue($columnHasWhitespaces->matches($this->sampleData[0])); $this->assertTrue($expressionHasWhitespaces->matches($this->sampleData[0])); $this->assertTrue($bothHaveWhitespaces->matches($this->sampleData[0])); + $this->assertTrue($withArray->matches($this->sampleData[0])); } private function row($idx)