Commit c3a8cba3 authored by Steve Müller's avatar Steve Müller

fallback to default MySQL port if not given in mysqli connection

parent 3149a9fd
...@@ -50,6 +50,12 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar ...@@ -50,6 +50,12 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
public function __construct(array $params, $username, $password, array $driverOptions = array()) public function __construct(array $params, $username, $password, array $driverOptions = array())
{ {
$port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port'); $port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port');
// Fallback to default MySQL port if not given.
if ( ! $port) {
$port = 3306;
}
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket'); $socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket');
$dbname = isset($params['dbname']) ? $params['dbname'] : null; $dbname = isset($params['dbname']) ? $params['dbname'] : null;
......
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