From 83a6e85b5db4e4b59950cdc6edea1151de4dcf8a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 22 May 2015 13:53:57 +0200 Subject: [PATCH] lib: Don't render empty filters to SQL Else we are presented with syntax errors. fixes #9211 --- library/Icinga/Data/Db/DbQuery.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 45a586b9a..4fa7f132d 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -166,10 +166,12 @@ class DbQuery extends SimpleQuery $parts[] = $filterPart; } } - if ($level > 0) { - $str .= ' (' . implode($op, $parts) . ') '; - } else { - $str .= implode($op, $parts); + if (! empty($parts)) { + if ($level > 0) { + $str .= ' (' . implode($op, $parts) . ') '; + } else { + $str .= implode($op, $parts); + } } } } else {