mirror of
https://github.com/php/php-src.git
synced 2025-08-17 14:38:49 +02:00
Fixed bug #43493 (pdo_pgsql does not send username on connect when password
is not available)
This commit is contained in:
parent
d161978c56
commit
56c610c97a
1 changed files with 4 additions and 4 deletions
|
@ -692,14 +692,14 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||||
}
|
}
|
||||||
|
|
||||||
/* support both full connection string & connection string + login and/or password */
|
/* support both full connection string & connection string + login and/or password */
|
||||||
if (!dbh->username || !dbh->password) {
|
if (dbh->username && dbh->password) {
|
||||||
spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
|
|
||||||
} else if (dbh->username && dbh->password) {
|
|
||||||
spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%ld", dbh->data_source, dbh->username, dbh->password, connect_timeout);
|
spprintf(&conn_str, 0, "%s user=%s password=%s connect_timeout=%ld", dbh->data_source, dbh->username, dbh->password, connect_timeout);
|
||||||
} else if (dbh->username) {
|
} else if (dbh->username) {
|
||||||
spprintf(&conn_str, 0, "%s user=%s connect_timeout=%ld", dbh->data_source, dbh->username, connect_timeout);
|
spprintf(&conn_str, 0, "%s user=%s connect_timeout=%ld", dbh->data_source, dbh->username, connect_timeout);
|
||||||
} else {
|
} else if (dbh->password) {
|
||||||
spprintf(&conn_str, 0, "%s password=%s connect_timeout=%ld", dbh->data_source, dbh->password, connect_timeout);
|
spprintf(&conn_str, 0, "%s password=%s connect_timeout=%ld", dbh->data_source, dbh->password, connect_timeout);
|
||||||
|
} else {
|
||||||
|
spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
H->server = PQconnectdb(conn_str);
|
H->server = PQconnectdb(conn_str);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue