diff --git a/ChangeLog b/ChangeLog
index fd6a4178ff..6be7895114 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ phpMyAdmin - ChangeLog
- issue #17366 Fix refresh rate popup on Monitor page
- issue #17577 Fix monitor charts size on RTL languages
- issue #17121 Fix password_hash function incorrectly adding single quotes to password before hashing
+- issue #17586 Fix statistics not showing for empty databases
5.2.0 (2022-05-10)
- issue #16521 Upgrade Bootstrap to version 5
diff --git a/libraries/classes/Controllers/Server/DatabasesController.php b/libraries/classes/Controllers/Server/DatabasesController.php
index 0bd4cba201..85360bbd79 100644
--- a/libraries/classes/Controllers/Server/DatabasesController.php
+++ b/libraries/classes/Controllers/Server/DatabasesController.php
@@ -255,8 +255,8 @@ class DatabasesController extends AbstractController
$statistics = $this->getStatisticsColumns();
if ($this->hasStatistics) {
foreach (array_keys($statistics) as $key) {
- $statistics[$key]['raw'] = (int) $database[$key] ?? 0;
- $totalStatistics[$key]['raw'] += (int) $database[$key] ?? 0;
+ $statistics[$key]['raw'] = (int) ($database[$key] ?? 0);
+ $totalStatistics[$key]['raw'] += (int) ($database[$key] ?? 0);
}
}
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index bea8d78d03..f1166a9a40 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -1345,11 +1345,6 @@ parameters:
count: 1
path: libraries/classes/Controllers/Server/BinlogController.php
- -
- message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
- count: 1
- path: libraries/classes/Controllers/Server/DatabasesController.php
-
-
message: "#^Method PhpMyAdmin\\\\Controllers\\\\Server\\\\DatabasesController\\:\\:getDatabases\\(\\) has parameter \\$primaryInfo with no value type specified in iterable type array\\.$#"
count: 1
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index c32158b3b9..2dbe4dc956 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -2402,7 +2402,8 @@
['db' => $database['SCHEMA_NAME']]
-
+
+ $database[$key]
$database[$key]
$database['DEFAULT_COLLATION_NAME']
$database['SCHEMA_NAME']
@@ -2425,13 +2426,12 @@
$databases[$database['SCHEMA_NAME']]
$databases[$database['SCHEMA_NAME']]
-
+
$database
$key
$key
$key
$key
- $statistics[$key]['raw']
$totalStatistics[$key]['raw']
@@ -2446,12 +2446,6 @@
$sortBy
$sortOrder
-
- (int) $database[$key]
-
-
- 0
-