Check DBA::count() result
This commit is contained in:
parent
644f312896
commit
89a085a12c
|
@ -1461,9 +1461,14 @@ class Database
|
||||||
|
|
||||||
$row = $this->fetchFirst($sql, $condition);
|
$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
|
// Ensure to always return either a "null" or a numeric value
|
||||||
return is_numeric($row['count']) ? (int)$row['count'] : $row['count'];
|
return is_numeric($row['count']) ? (int)$row['count'] : $row['count'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills an array with data from a query
|
* Fills an array with data from a query
|
||||||
|
|
Loading…
Reference in New Issue
Block a user