From fac2ebce8051d56144d79930bb58a220b0cbac1a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 21 May 2015 15:02:56 +0200 Subject: [PATCH] RepositoryQuery: Fix handling of queries returning no results in fetchColumn() refs #8826 --- library/Icinga/Repository/RepositoryQuery.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Repository/RepositoryQuery.php b/library/Icinga/Repository/RepositoryQuery.php index bdd51f53f..b25f8d00c 100644 --- a/library/Icinga/Repository/RepositoryQuery.php +++ b/library/Icinga/Repository/RepositoryQuery.php @@ -379,7 +379,7 @@ class RepositoryQuery implements QueryInterface, Iterator /** * Fetch and return the first column of this query's first row * - * @return mixed + * @return mixed|false False in case of no result */ public function fetchOne() { @@ -400,7 +400,7 @@ class RepositoryQuery implements QueryInterface, Iterator /** * Fetch and return the first row of this query's result * - * @return object + * @return object|false False in case of no result */ public function fetchRow() { @@ -434,7 +434,7 @@ class RepositoryQuery implements QueryInterface, Iterator } $results = $this->query->fetchColumn(); - if ($results !== false && $this->repository->providesValueConversion()) { + if (! empty($results) && $this->repository->providesValueConversion()) { $columns = $this->getColumns(); $aliases = array_keys($columns); $column = is_int($aliases[0]) ? $columns[0] : $aliases[0];