php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68750
Patch PDO_MYSQLWin32-001.patch revision 2015-01-05 15:55 UTC by steffen at howarts dot info

Patch PDO_MYSQLWin32-001.patch for PDO MySQL Bug #68750

Patch version 2015-01-05 15:55 UTC

Return to Bug #68750 | Download this patch
Patch Revisions:

Developer: steffen@howarts.info

From ee55e642a9ff12c3475d21e5f5c796fd0b54472b Mon Sep 17 00:00:00 2001
From: steffen <steffenb198@aol.com>
Date: Mon, 5 Jan 2015 16:50:20 +0100
Subject: [PATCH] PDO_MySQL: Differentiate between linux and win32 when passing
 unix_socket

Unix uses "127.0.0.1" as default host for named pipes,
while when using Windows a "." is required as host by mysqlnd.
(This can be seen at mysqlnd.c (line 945 or searching #ifndef PHP_WIN32)
---
 ext/pdo_mysql/mysql_driver.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 4f75f02..bef53d8 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -748,9 +748,14 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
 	if(vars[3].optval) {
 		port = atoi(vars[3].optval);
 	}
-	if (vars[2].optval && !strcmp("localhost", vars[2].optval)) {
-		unix_socket = vars[4].optval;  
-	}
+
+#ifdef PHP_WIN32
+	if (vars[2].optval && !strcmp(".", vars[2].optval)) {
+#else
+    if (vars[2].optval && !strcmp("localhost", vars[2].optval)) {
+#endif
+        unix_socket = vars[4].optval;
+    }
 
 	/* TODO: - Check zval cache + ZTS */
 #ifdef PDO_USE_MYSQLND
-- 
1.9.2.msysgit.0

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC