Check DBA::count() result

pull/10704/head
Philipp 2021-09-13 20:31:14 +02:00
rodzic 644f312896
commit 89a085a12c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 24A7501396EB5432
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -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'];
}
}
/**