diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-12-20 00:26:21 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-12-20 00:26:21 +0000 |
commit | a6e755d6aad75ba47f6a8bd655f045789aa7964d (patch) | |
tree | c11d927aeffaacf7eedd91484801ee4595fe273f /ext/mysql/php_mysql.c | |
parent | 1ccf0ba714c92ad0f13e219d3a4cccc29040f638 (diff) | |
download | php-git-a6e755d6aad75ba47f6a8bd655f045789aa7964d.tar.gz |
Fixed bug #43635 (mysql extension ingores INI settings on NULL values passed
to mysql_connect())
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r-- | ext/mysql/php_mysql.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index eeca44fb6e..ed86e2a0a4 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -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; |