Commit 929120f1 authored by Oleg Khimich's avatar Oleg Khimich

bugfix: failover to database configuration values if no ability to get database from DSN

parent 76a5dbc8
......@@ -195,14 +195,15 @@ class Connection extends BaseConnection
}
/**
* Get database name from DSN string.
* Get database name from DSN string, if there is no database in DSN path - returns back $database argument.
* @param string $dsn
* @param $database
* @return string
*/
protected function getDatabaseDsn($dsn, $database)
{
$dsnDatabase = trim(parse_url($dsn, PHP_URL_PATH), '/');
return $dsnDatabase?:$database;
return trim($dsnDatabase) ? $dsnDatabase : $database;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment