summaryrefslogtreecommitdiff
path: root/ext/pdo_odbc/odbc_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_odbc/odbc_driver.c')
-rwxr-xr-xext/pdo_odbc/odbc_driver.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index cdd55223f1..ced91d6fbb 100755
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -334,7 +334,8 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_D
use_direct = 1;
/* Force UID and PWD to be set in the DSN */
- if (*dbh->username && !strstr(dbh->data_source, "uid") && !strstr(dbh->data_source, "UID")) {
+ if (dbh->username && *dbh->username && !strstr(dbh->data_source, "uid")
+ && !strstr(dbh->data_source, "UID")) {
char *dsn = pemalloc(strlen(dbh->data_source) + strlen(dbh->username) + strlen(dbh->password) + sizeof(";UID=;PWD="), dbh->is_persistent);
sprintf(dsn, "%s;UID=%s;PWD=%s", dbh->data_source, dbh->username, dbh->password);
pefree((char*)dbh->data_source, dbh->is_persistent);