diff options
author | Johannes Schlüter <johannes@php.net> | 2008-02-12 20:43:42 +0000 |
---|---|---|
committer | Johannes Schlüter <johannes@php.net> | 2008-02-12 20:43:42 +0000 |
commit | 2c079e328bfc99b593a81b82ac37e0a28297293a (patch) | |
tree | 888bbdacebd9847979329f39bd388a4163b01978 /ext/mysql | |
parent | d211430aa7f5fda51fc9366487dd6aace25d3c91 (diff) | |
download | php-git-2c079e328bfc99b593a81b82ac37e0a28297293a.tar.gz |
- MFH: Make clear what's going on and avoid overwriting parameters
Diffstat (limited to 'ext/mysql')
-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; |