From 7c9633412e1598495dfe547071a2a1481bfc052b Mon Sep 17 00:00:00 2001 From: steffen Date: Mon, 5 Jan 2015 16:50:20 +0100 Subject: [PATCH 1/2] 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 88c863bac5a..1282c5bc77a 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -743,9 +743,14 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ 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 From 0cef7d168dd66df6ec714f1a0dfec2682da26bce Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 15 Jan 2015 16:42:17 +0100 Subject: [PATCH 2/2] updated NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index b0df78373bb..22c7197a27a 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ PHP NEWS . Fix bug #68260 (SQLite3Result::fetchArray declares wrong required_num_args). (Julien) +- PDO_mysql: + . Fixed bug #68750 (PDOMysql with mysqlnd does not allow the usage of + named pipes). (steffenb198@aol.com) + 22 Jan 2014, PHP 5.5.21 - Core: