diff --git a/NEWS b/NEWS index 231c1601cd5..8eb5196ff48 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ PHP NEWS . Backwards-compatible mappings for 0x5C/0x7E in Shift-JIS are restored, after they had been changed in 8.1.0. (Alex Dowad) +- ODBC: + . Fixed handling of single-key connection strings. (Calvin Buckley) + - OPcache: . Fixed bug GH-8591 (tracing JIT crash after private instance method change). (Arnaud, Dmitry, Oleg Stepanischev) @@ -34,6 +37,9 @@ PHP NEWS . Fixed bug #81713 (NULL byte injection in several OpenSSL functions working with certificates). (Jakub Zelenka) +- PDO_ODBC: + . Fixed handling of single-key connection strings. (Calvin Buckley) + 09 Jun 2022, PHP 8.1.7 - CLI: diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index a99785985ff..dd2bbd03e79 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -2167,7 +2167,8 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int char *ldb = 0; int ldb_len = 0; - if (strstr((char*)db, ";")) { + /* a connection string may have = but not ; - i.e. "DSN=PHP" */ + if (strstr((char*)db, "=")) { direct = 1; if (uid && !strstr ((char*)db, "uid") && !strstr((char*)db, "UID")) { spprintf(&ldb, 0, "%s;UID=%s;PWD=%s", db, uid, pwd); diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 4f59913937a..42a95c5707c 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -478,7 +478,8 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ goto fail; } - if (strchr(dbh->data_source, ';')) { + /* a connection string may have = but not ; - i.e. "DSN=PHP" */ + if (strchr(dbh->data_source, '=')) { SQLCHAR dsnbuf[1024]; SQLSMALLINT dsnbuflen;