com php-src: PDO_MySQL: Differentiate between linux and win32 when passing unix_socket: ext/pd o_mysql/mysql_driver.c
| From: | Anatol Belski | Date: | Thu, 15 Jan 2015 15:42:51 +0000 |
| Subject: | com php-src: PDO_MySQL: Differentiate between linux and win32 when passing unix_socket: ext/pd o_mysql/mysql_driver.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84117@lists.php.net to get a copy of this message | ||
Commit: 7c9633412e1598495dfe547071a2a1481bfc052b
Author: steffen <steffenb198@aol.com> Mon, 5 Jan 2015 16:50:20 +0100
Committer: Anatol Belski <ab@php.net> Thu, 15 Jan 2015 16:42:51 +0100
Parents: 73c1be26531f730d64d61962b56eaf28ce3fc6aa
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7c9633412e1598495dfe547071a2a1481bfc052b
Log:
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)
Changed paths:
M ext/pdo_mysql/mysql_driver.c
Diff:
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 88c863b..1282c5b 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