Skip to content

Commit 9767ef1

Browse files
author
Karel Wintersky
committed
1.2.1
- PHP7.4 & PHP8 compatible - DBConfig can accept empty `credentials` argument
1 parent 7da37d2 commit 9767ef1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sources/Database/DBConfig.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ public function __construct(array $connection_config = [], array $options = [],
9191
{
9292
$this->logger = $logger ?? new NullLogger();
9393

94-
if (empty($connection_config)) {
94+
/*if (empty($connection_config)) {
9595
$this->logger->emergency("[DBWrapper Error] Connection config is empty");
9696
throw new \RuntimeException("[DBWrapper Error] Connection config is empty");
97-
}
97+
}*/
9898

9999
$this->db_config = $connection_config;
100100
$this->driver = $connection_config['driver'] ?? 'mysql';
101101
$this->hostname = $connection_config['hostname'] ?? '127.0.0.1';
102102
$this->port = $connection_config['port'] ?? 3306;
103103
$this->username = $connection_config['username'] ?? 'root';
104-
$this->password = $connection_config['password'];
105-
$this->database = $connection_config['database'];
104+
$this->password = $connection_config['password'] ?? '';
105+
$this->database = $connection_config['database'] ?? '';
106106
$this->is_lazy = true;
107107

108108
if (!\array_key_exists('charset', $this->db_config)) {

0 commit comments

Comments
 (0)