From c10c2d102fc629934030516c1e62391e68ba19fe Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 4 Dec 2007 13:07:30 +0000 Subject: [PATCH] MFB: Fixed bug #43493 (pdo_pgsql does not send username on connect when password is not available) --- ext/pdo_pgsql/pgsql_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 85bcfaa84cf..41e116423cd 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -493,14 +493,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 */ - if (!dbh->username || !dbh->password) { - conn_str = (char *) dbh->data_source; - } else if (dbh->username && dbh->password) { + if (dbh->username && dbh->password) { spprintf(&conn_str, 0, "%s user=%s password=%s", dbh->data_source, dbh->username, dbh->password); } else if (dbh->username) { spprintf(&conn_str, 0, "%s user=%s", dbh->data_source, dbh->username); - } else { + } else if (dbh->password) { spprintf(&conn_str, 0, "%s password=%s", dbh->data_source, dbh->password); + } else { + conn_str = (char *) dbh->data_source; } H->server = PQconnectdb(conn_str);