1
1
Fork 0

Check DBA::count() result

This commit is contained in:
Philipp Holzer 2021-09-13 20:31:14 +02:00
parent 644f312896
commit 89a085a12c
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432

View file

@ -1461,8 +1461,13 @@ class Database
$row = $this->fetchFirst($sql, $condition);
// Ensure to always return either a "null" or a numeric value
return is_numeric($row['count']) ? (int)$row['count'] : $row['count'];
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'];
}
}
/**