]> granicus.if.org Git - php/commitdiff
MFH: Fix an issue with mysql.default_port not being used
authorAndrey Hristov <andrey@php.net>
Mon, 27 Oct 2008 14:36:02 +0000 (14:36 +0000)
committerAndrey Hristov <andrey@php.net>
Mon, 27 Oct 2008 14:36:02 +0000 (14:36 +0000)
ext/mysqli/mysqli_api.c
ext/mysqli/mysqli_nonapi.c

index 48027f0318a9d0018fb5ad967d66a454d4d22362..9be504f28c56495ec91f1cf710e134649ea5cf54 100644 (file)
@@ -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);
                }
        }       
 
index 40395e3ab9d7b273bdb92d242833f215e11d64a8..4fb6c5a6cd64f91cb0f0a6d5a3d96d2160226a1f 100644 (file)
@@ -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);
                }
        }