diff options
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r-- | ext/mysql/php_mysql.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 9d5aedc699..0bdefa4f2c 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -643,10 +643,19 @@ 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 { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len, - &user, &user_len, &passwd, &passwd_len, - &new_link, &client_flags)==FAILURE) { - return; + /* mysql_pconnect does not support new_link parameter */ + if (persistent) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!l", &host_and_port, &host_len, + &user, &user_len, &passwd, &passwd_len, + &client_flags)==FAILURE) { + return; + } + } else { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!bl", &host_and_port, &host_len, + &user, &user_len, &passwd, &passwd_len, + &new_link, &client_flags)==FAILURE) { + return; + } } if (!host_and_port) { @@ -659,11 +668,6 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) passwd = MySG(default_password); } - /* mysql_pconnect does not support new_link parameter */ - if (persistent) { - client_flags= new_link; - } - /* disable local infile option for open_basedir */ if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) { client_flags ^= CLIENT_LOCAL_FILES; |