mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fix handling of single-key connection strings
A connection string may contain just a single key, but PHP used ";" as the heuristic to detect if a string was a connection string versus plain DSN. However, a single-key connection string would get treated like a DSN name, i.e. "DSN=*LOCAL". This makes it so that "=" is used, as a connection string must contain a key. Closes GH-8748.
This commit is contained in:
parent
df4dd82ea0
commit
445d9502bf
6
NEWS
6
NEWS
@ -10,14 +10,18 @@ PHP NEWS
|
||||
- MBString:
|
||||
. Fixed bug GH-8685 (pcre not ready at mbstring startup). (Remi)
|
||||
|
||||
- ODBC:
|
||||
. Fixed handling of single-key connection strings. (Calvin Buckley)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #50293 (Several openssl functions ignore the VCWD).
|
||||
(Jakub Zelenka, cmb)
|
||||
. Fixed bug #81713 (NULL byte injection in several OpenSSL functions working
|
||||
with certificates). (Jakub Zelenka)
|
||||
|
||||
- PDO ODBC:
|
||||
- PDO_ODBC:
|
||||
. Fixed errorInfo() result on successful PDOStatement->execute(). (Yurunsoft)
|
||||
. Fixed handling of single-key connection strings. (Calvin Buckley)
|
||||
|
||||
09 Jun 2022, PHP 8.0.20
|
||||
|
||||
|
@ -2156,7 +2156,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);
|
||||
|
@ -437,7 +437,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user