Check DBA::count() result
This commit is contained in:
parent
644f312896
commit
89a085a12c
1 changed files with 7 additions and 2 deletions
|
@ -1461,9 +1461,14 @@ class Database
|
|||
|
||||
$row = $this->fetchFirst($sql, $condition);
|
||||
|
||||
if (empty($row['count'])) {
|
||||
$this->logger->notice('Invalid count.', ['table' => $table, 'expression' => $expression, 'condition' => $condition_string]);
|
||||
return 0;
|
||||
} else {
|
||||
// Ensure to always return either a "null" or a numeric value
|
||||
return is_numeric($row['count']) ? (int)$row['count'] : $row['count'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills an array with data from a query
|
||||
|
|
Loading…
Reference in a new issue