Merge pull request #3836 from Icinga/fix/query-double-execution

Fix double query execution
This commit is contained in:
Johannes Meyer 2019-07-02 13:56:50 +02:00 committed by GitHub
commit 6ea012af7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -450,7 +450,17 @@ class SimpleQuery implements QueryInterface, Queryable, Iterator
*/
public function hasResult()
{
return $this->iteratorPosition !== null || $this->fetchRow() !== false;
if ($this->iteratorPosition !== null) {
return true;
}
$hasResult = false;
foreach ($this as $row) {
$hasResult = true;
break;
}
return $hasResult;
}
/**