Skip to content

Commit e7f6acd

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix handling of single-key connection strings
2 parents 02e0ae9 + 4b8bbfb commit e7f6acd

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ PHP NEWS
1414
. Backwards-compatible mappings for 0x5C/0x7E in Shift-JIS are restored,
1515
after they had been changed in 8.1.0. (Alex Dowad)
1616

17+
- ODBC:
18+
. Fixed handling of single-key connection strings. (Calvin Buckley)
19+
20+
- PDO_ODBC:
21+
. Fixed handling of single-key connection strings. (Calvin Buckley)
22+
1723
- Standard:
1824
. Deprecated utf8_encode() and utf8_decode(). (Rowan Tommins)
1925

ext/odbc/php_odbc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,8 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int
21732173
char *ldb = 0;
21742174
int ldb_len = 0;
21752175

2176-
if (strstr((char*)db, ";")) {
2176+
/* a connection string may have = but not ; - i.e. "DSN=PHP" */
2177+
if (strstr((char*)db, "=")) {
21772178
direct = 1;
21782179
/* Force UID and PWD to be set in the DSN */
21792180
bool is_uid_set = uid && *uid

ext/pdo_odbc/odbc_driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ static int pdo_odbc_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
480480
goto fail;
481481
}
482482

483-
if (strchr(dbh->data_source, ';')) {
483+
/* a connection string may have = but not ; - i.e. "DSN=PHP" */
484+
if (strchr(dbh->data_source, '=')) {
484485
SQLCHAR dsnbuf[1024];
485486
SQLSMALLINT dsnbuflen;
486487

0 commit comments

Comments
 (0)