diff --git a/webprofiler/src/DataCollector/DatabaseDataCollector.php b/webprofiler/src/DataCollector/DatabaseDataCollector.php index 2c766a4150562b473dde34c6eef08e3b237a511e..ddfbab3c0d768c5d2c3981fbdb2b9e6534e28edc 100644 --- a/webprofiler/src/DataCollector/DatabaseDataCollector.php +++ b/webprofiler/src/DataCollector/DatabaseDataCollector.php @@ -43,8 +43,16 @@ class DatabaseDataCollector extends DataCollector implements DrupalDataCollector public function collect(Request $request, Response $response, \Exception $exception = NULL) { $connections = []; foreach (Database::getAllConnectionInfo() as $key => $info) { - $database = Database::getConnection('default', $key); - $connections[$key] = $database->getLogger()->get('webprofiler'); + try { + $database = Database::getConnection('default', $key); + + if ($database->getLogger()) { + $connections[$key] = $database->getLogger()->get('webprofiler'); + } + } catch(\Exception $e) { + // There was some error during database connection, maybe a stale + // configuration in settings.php or wrong values used for a migration. + } } $this->data['connections'] = array_keys($connections);