summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-03-26 16:58:25 +0000
committerAndrey Hristov <andrey@php.net>2010-03-26 16:58:25 +0000
commitec36ac1610abc321d18586304fe8d28f3d5190c3 (patch)
treef28e5fa6a445e65e113dcacdbd7fd0585052994f /ext/mysqlnd/mysqlnd.c
parent53cfb3d53df9e2115f404bb98d89653b7a5bbd1d (diff)
downloadphp-git-ec36ac1610abc321d18586304fe8d28f3d5190c3.tar.gz
Fix tests that fail when the MySQL's socket file is not /tmp/mysql.sock
as it is in when compiled from source and the default for mysqlnd. SuSE for example uses /var/run/mysql/mysql.sock . Also, sql.safe_mode (ext/mysql and ingres) needs the socket. Fix possible crashes in mysqlnd. When packets are shorter, functions should return error.
Diffstat (limited to 'ext/mysqlnd/mysqlnd.c')
-rw-r--r--ext/mysqlnd/mysqlnd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 3a31a1d7e6..4f89b8c57e 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -516,20 +516,24 @@ MYSQLND_METHOD(mysqlnd_conn, connect)(MYSQLND *conn,
if (!host || !host[0]) {
host = "localhost";
}
- if (!user || !user[0]) {
- user = php_get_current_user();
+ if (!user) {
+ DBG_INF_FMT("no user given, using empty string");
+ user = "";
}
if (!passwd) {
+ DBG_INF_FMT("no password given, using empty string");
passwd = "";
passwd_len = 0;
}
if (!db) {
+ DBG_INF_FMT("no db given, using empty string");
db = "";
db_len = 0;
}
host_len = strlen(host);
#ifndef PHP_WIN32
if (host_len == sizeof("localhost") - 1 && !strncasecmp(host, "localhost", host_len)) {
+ DBG_INF_FMT("socket=%s", socket? socket:"n/a");
if (!socket) {
socket = "/tmp/mysql.sock";
}