From: Andrey Hristov Date: Mon, 27 Oct 2008 14:36:02 +0000 (+0000) Subject: MFH: Fix an issue with mysql.default_port not being used X-Git-Tag: php-5.2.7RC3~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc710ce12f12840c821c4f282a9d2dae8132dc91;p=php MFH: Fix an issue with mysql.default_port not being used --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 48027f0318..9be504f28c 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1425,14 +1425,20 @@ PHP_FUNCTION(mysqli_real_connect) /* TODO: safe mode handling */ if (PG(sql_safe_mode)) { } else { + if (!socket_len || !socket) { + socket = MyG(default_socket); + } + if (!port) { + port = MyG(default_port); + } if (!passwd) { passwd = MyG(default_pw); - if (!username){ - username = MyG(default_user); - if (!hostname) { - hostname = MyG(default_host); - } - } + } + if (!username){ + username = MyG(default_user); + } + if (!hostname) { + hostname = MyG(default_host); } } diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 40395e3ab9..4fb6c5a6cd 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -56,14 +56,20 @@ PHP_FUNCTION(mysqli_connect) /* TODO: safe mode handling */ if (PG(sql_safe_mode)){ } else { + if (!socket_len || !socket) { + socket = MyG(default_socket); + } + if (!port) { + port = MyG(default_port); + } if (!passwd) { passwd = MyG(default_pw); - if (!username){ - username = MyG(default_user); - if (!hostname) { - hostname = MyG(default_host); - } - } + } + if (!username){ + username = MyG(default_user); + } + if (!hostname) { + hostname = MyG(default_host); } }