From 4ae4b93d9eb0401b32259d118ecf7df8cc4b9d41 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 31 Oct 2014 12:03:45 +0100 Subject: [PATCH] Backporting a fix to allow connection without dbname The fix is already in master at https://github.com/doctrine/dbal/commit/387eb5457498781e24716286a2511f5d030d63fb but because it has not been backported the functionnality is still broken for symfony 2.5 for instance. --- lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php index 3ea1c987e98..b4d4f9db59a 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php @@ -43,9 +43,10 @@ public function __construct(array $params, $username, $password, array $driverOp { $port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port'); $socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket'); + $dbname = isset($params['dbname']) ? $params['dbname'] : null; $this->_conn = mysqli_init(); - if ( ! $this->_conn->real_connect($params['host'], $username, $password, $params['dbname'], $port, $socket)) { + if ( ! $this->_conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket)) { throw new MysqliException($this->_conn->connect_error, $this->_conn->connect_errno); }