]>
Commit | Line | Data |
---|---|---|
f9fed404 AM |
1 | diff -urNp -x '*.orig' php-5.2.17.org/ext/mysql/php_mysql.c php-5.2.17/ext/mysql/php_mysql.c |
2 | --- php-5.2.17.org/ext/mysql/php_mysql.c 2010-08-21 18:19:30.000000000 +0200 | |
3 | +++ php-5.2.17/ext/mysql/php_mysql.c 2021-10-23 19:06:47.816458427 +0200 | |
4 | @@ -360,6 +360,7 @@ PHP_INI_BEGIN() | |
5624399c ER |
5 | PHP_INI_ENTRY("mysql.default_port", NULL, PHP_INI_ALL, OnMySQLPort) |
6 | STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals) | |
7 | STD_PHP_INI_ENTRY("mysql.connect_timeout", "60", PHP_INI_ALL, OnUpdateLong, connect_timeout, zend_mysql_globals, mysql_globals) | |
8 | + STD_PHP_INI_ENTRY("mysql.connect_charset", NULL, PHP_INI_ALL, OnUpdateString, connect_charset, zend_mysql_globals, mysql_globals) | |
9 | STD_PHP_INI_BOOLEAN("mysql.trace_mode", "0", PHP_INI_ALL, OnUpdateLong, trace_mode, zend_mysql_globals, mysql_globals) | |
10 | PHP_INI_END() | |
11 | /* }}} */ | |
f9fed404 | 12 | @@ -376,6 +377,7 @@ static PHP_GINIT_FUNCTION(mysql) |
5624399c ER |
13 | mysql_globals->connect_errno = 0; |
14 | mysql_globals->connect_error = NULL; | |
15 | mysql_globals->connect_timeout = 0; | |
16 | + mysql_globals->connect_charset = NULL; | |
17 | mysql_globals->trace_mode = 0; | |
18 | mysql_globals->result_allocated = 0; | |
19 | } | |
f9fed404 | 20 | @@ -515,6 +517,7 @@ static void php_mysql_do_connect(INTERNA |
5624399c ER |
21 | { |
22 | char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL; | |
23 | int user_len, passwd_len, host_len; | |
24 | + char *connect_charset=NULL; | |
25 | char *hashed_details=NULL; | |
26 | int hashed_details_length, port = MYSQL_PORT; | |
f9fed404 AM |
27 | long client_flags = 0; |
28 | @@ -527,6 +530,7 @@ static void php_mysql_do_connect(INTERNA | |
5624399c ER |
29 | |
30 | ||
31 | connect_timeout = MySG(connect_timeout); | |
32 | + connect_charset = MySG(connect_charset); | |
33 | ||
34 | socket = MySG(default_socket); | |
35 | ||
f9fed404 | 36 | @@ -644,6 +648,9 @@ static void php_mysql_do_connect(INTERNA |
5624399c ER |
37 | mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); |
38 | } | |
39 | ||
40 | + if (connect_charset != NULL) | |
41 | + mysql_options(&mysql->conn, MYSQL_SET_CHARSET_NAME, connect_charset); | |
42 | + | |
43 | if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) { | |
44 | #else | |
45 | if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) { | |
f9fed404 | 46 | @@ -688,6 +695,9 @@ static void php_mysql_do_connect(INTERNA |
5624399c ER |
47 | signal(SIGPIPE, handler); |
48 | #endif /* end mysql_ping */ | |
49 | #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ | |
50 | + if (connect_charset != NULL) | |
51 | + mysql_options(le->ptr, MYSQL_SET_CHARSET_NAME, connect_charset); | |
52 | + | |
53 | if (mysql_real_connect(le->ptr, host, user, passwd, NULL, port, socket, client_flags)==NULL) { | |
54 | #else | |
55 | if (mysql_connect(le->ptr, host, user, passwd)==NULL) { | |
f9fed404 | 56 | @@ -751,6 +761,9 @@ static void php_mysql_do_connect(INTERNA |
5624399c ER |
57 | mysql_options(&mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); |
58 | } | |
59 | ||
60 | + if (connect_charset != NULL) | |
61 | + mysql_options(&mysql->conn, MYSQL_SET_CHARSET_NAME, connect_charset); | |
62 | + | |
63 | if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) { | |
64 | #else | |
65 | if (mysql_connect(&mysql->conn, host, user, passwd)==NULL) { | |
f9fed404 AM |
66 | diff -urNp -x '*.orig' php-5.2.17.org/ext/mysql/php_mysql_structs.h php-5.2.17/ext/mysql/php_mysql_structs.h |
67 | --- php-5.2.17.org/ext/mysql/php_mysql_structs.h 2010-01-03 10:23:27.000000000 +0100 | |
68 | +++ php-5.2.17/ext/mysql/php_mysql_structs.h 2021-10-23 19:06:47.816458427 +0200 | |
69 | @@ -103,6 +103,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mysql) | |
5624399c ER |
70 | long default_port; |
71 | char *default_host, *default_user, *default_password; | |
72 | char *default_socket; | |
73 | + char *connect_charset; | |
74 | char *connect_error; | |
75 | long connect_errno; | |
76 | long connect_timeout; |