summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-03-18 16:57:31 +0000
committerAndrey Hristov <andrey@php.net>2008-03-18 16:57:31 +0000
commitcaf3e9c3f1c329b496b00501b8baef4dbfc66b4f (patch)
tree256aa613a7db94da81fb7ecbda0efaf040e23d3d /ext/mysqlnd
parentbd9e02695154548e66ebec844c21f900f88ae7c0 (diff)
downloadphp-git-caf3e9c3f1c329b496b00501b8baef4dbfc66b4f.tar.gz
Fixed a bunch of bugs reported in
Bug #44352 mysqli_connect_error() false negative for host errors From now on the mysqli object doesn't have that magic properties, like error, which were readable but not visible through isset(), property_exists() and var_dump(). All other ext/mysqli classes were fixed too. Now it will be easier to debug mysqli based applications.
Diffstat (limited to 'ext/mysqlnd')
-rw-r--r--ext/mysqlnd/mysqlnd.c3
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h6
2 files changed, 4 insertions, 5 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index bda568bd19..b3ac202441 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -805,8 +805,7 @@ err:
if (errstr) {
DBG_ERR_FMT("[%d] %.64s (trying to connect via %s)", errcode, errstr, conn->scheme);
- SET_CLIENT_ERROR(conn->error_info, errcode, UNKNOWN_SQLSTATE, errstr);
-
+ SET_CLIENT_ERROR(conn->error_info, errcode? errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "[%d] %.64s (trying to connect via %s)", errcode, errstr, conn->scheme);
mnd_efree(errstr);
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index 337d4186e6..7ffbc67eaf 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -148,9 +148,9 @@
#define SET_CLIENT_ERROR(error_info, a, b, c) \
{ \
- error_info.error_no = a; \
- strlcpy(error_info.sqlstate, b, sizeof(error_info.sqlstate)); \
- strlcpy(error_info.error, c, sizeof(error_info.error)); \
+ error_info.error_no = (a); \
+ strlcpy(error_info.sqlstate, (b), sizeof(error_info.sqlstate)); \
+ strlcpy(error_info.error, (c), sizeof(error_info.error)); \
}
#define SET_STMT_ERROR(stmt, a, b, c) SET_CLIENT_ERROR(stmt->error_info, a, b, c)