com php-src: Ignore potentially misleading dberr values: ext/pdo_dblib/dblib_driver.c
| From: | Adam Baratz | Date: | Mon, 26 Sep 2016 21:07:46 +0000 |
| Subject: | com php-src: Ignore potentially misleading dberr values: ext/pdo_dblib/dblib_driver.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94721@lists.php.net to get a copy of this message | ||
Commit: 48b5a1f9b9f473a86c02c6461c3eb0930c9c8aa9
Author: Chris Kings-Lynne <chris.kingslynne@gmail.com> Fri, 13 Sep 2013 14:09:08
+0800
Committer: Adam Baratz <adambaratz@php.net> Mon, 26 Sep 2016 17:07:46 -0400
Parents: 3a058e3817fab41f9986fb353f337d32283a32b3
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=48b5a1f9b9f473a86c02c6461c3eb0930c9c8aa9
Log:
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.
Changed paths:
M ext/pdo_dblib/dblib_driver.c
Diff:
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index b8ec4fb..70d1a1c 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 {