From ec36ac1610abc321d18586304fe8d28f3d5190c3 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 26 Mar 2010 16:58:25 +0000 Subject: 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. --- ext/mysqlnd/mysqlnd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/mysqlnd/mysqlnd.c') 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"; } -- cgit v1.2.1