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