]> granicus.if.org Git - php/commitdiff
Fixed bug #43635 (mysql extension ingores INI settings on NULL values passed
authorIlia Alshanetsky <iliaa@php.net>
Thu, 20 Dec 2007 00:26:21 +0000 (00:26 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 20 Dec 2007 00:26:21 +0000 (00:26 +0000)
to mysql_connect())

ext/mysql/php_mysql.c

index eeca44fb6e94584b87ade05e9f334c554e68146b..ed86e2a0a4e4398a9dee07a1e78957170753acc1 100644 (file)
@@ -643,16 +643,22 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
                hashed_details_length = spprintf(&hashed_details, 0, "mysql__%s_", user);
                client_flags = CLIENT_INTERACTIVE;
        } else {
-               host_and_port = MySG(default_host);
-               user = MySG(default_user);
-               passwd = MySG(default_password);
-               
-               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sssll", &host_and_port, &host_len,
+               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!ll", &host_and_port, &host_len,
                                                                        &user, &user_len, &passwd, &passwd_len, 
                                                                        &new_link, &client_flags)==FAILURE) {
                        WRONG_PARAM_COUNT;
                }
 
+               if (!host_and_port) {
+                       host_and_port = MySG(default_host);
+               }
+               if (!user) {
+                       user = MySG(default_user);
+               }
+               if (!passwd) {
+                       passwd = MySG(default_password);
+               }
+
                /* mysql_pconnect does not support new_link parameter */
                if (persistent) {
                        client_flags= new_link;