summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2008-02-12 20:43:50 +0000
committerJohannes Schlüter <johannes@php.net>2008-02-12 20:43:50 +0000
commit201a2ec1f0a1e517a0620b013c0b1e29b3cb3951 (patch)
tree22f225163f685e8266407f049dabd8ff12eb4e99 /ext/mysql/php_mysql.c
parent8fbb789d04e08c93fb5156c33f5a017808daee9d (diff)
downloadphp-git-201a2ec1f0a1e517a0620b013c0b1e29b3cb3951.tar.gz
- MFH: Make clear what's going on and avoid overwriting parameters
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index c9d0531401..f6bd8e4343 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -556,10 +556,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) {
@@ -572,11 +581,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;