From 48b5a1f9b9f473a86c02c6461c3eb0930c9c8aa9 Mon Sep 17 00:00:00 2001 From: Chris Kings-Lynne Date: Fri, 13 Sep 2013 14:09:08 +0800 Subject: [PATCH 1/3] Ignore potentially misleading dberr values FreeTDS had a buggy behavior where it would pass invalid values: https://sourceforge.net/p/freetds/bugs/59/ The fix for this issue -- bc22b2ef817fb5d102bd758111ff3634b39a1319 on their repo -- was to always use SYBESMSG for dberr. This makes it so the existing pdo_dblib code would work as is. But by ignoring the dberr value in this function, it will behave correctly, even with older versions of FreeTDS. --- ext/pdo_dblib/dblib_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index b8ec4fb48e2..70d1a1cf601 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -48,9 +48,9 @@ static int dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) einfo = &S->err; } - if (einfo->dberr == SYBESMSG && einfo->lastmsg) { + if (einfo->lastmsg) { msg = einfo->lastmsg; - } else if (einfo->dberr == SYBESMSG && DBLIB_G(err).lastmsg) { + } else if (DBLIB_G(err).lastmsg) { msg = DBLIB_G(err).lastmsg; DBLIB_G(err).lastmsg = NULL; } else { From 6887c4a06146252c156bcd270828774ed97b5b9f Mon Sep 17 00:00:00 2001 From: Adam Baratz Date: Mon, 26 Sep 2016 17:09:11 -0400 Subject: [PATCH 2/3] update NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index ba94b93f53c..aa17db7c911 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ PHP NEWS (Adam Baratz) . Fixed bug #67130 (\PDOStatement::nextRowset() should succeed when all rows in current rowset haven't been fetched). (Peter LeBrun) + . Ignore potentially misleading dberr values. (Chris Kings-Lynne) - phpdbg: . Fixed bug #72996 (phpdbg_prompt.c undefined reference to DL_LOAD). (Nikita) From 228be4c39da29409146fa8784d3f170ac03b8636 Mon Sep 17 00:00:00 2001 From: Adam Baratz Date: Mon, 26 Sep 2016 17:13:50 -0400 Subject: [PATCH 3/3] update NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 4d36e42d0b6..e40a91e76e2 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,7 @@ PHP NEWS (Adam Baratz) . Fixed bug #67130 (\PDOStatement::nextRowset() should succeed when all rows in current rowset haven't been fetched). (Peter LeBrun) + . Ignore potentially misleading dberr values. (Chris Kings-Lynne) - Session: . Fixed bug #73100 (session_destroy null dereference in ps_files_path_create).