]>
Commit | Line | Data |
---|---|---|
791b59e4 JR |
1 | diff -urNp -x '*.orig' php-5.6.40.org/ext/mysql/php_mysql.c php-5.6.40/ext/mysql/php_mysql.c |
2 | --- php-5.6.40.org/ext/mysql/php_mysql.c 2019-01-09 10:54:13.000000000 +0100 | |
3 | +++ php-5.6.40/ext/mysql/php_mysql.c 2021-08-23 23:19:37.539114406 +0200 | |
4 | @@ -506,6 +506,7 @@ PHP_INI_BEGIN() | |
c0240cb1 | 5 | STD_PHP_INI_ENTRY("mysql.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysql_globals, mysql_globals) |
791b59e4 | 6 | #endif |
c0240cb1 | 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) | |
791b59e4 | 10 | STD_PHP_INI_BOOLEAN("mysql.allow_local_infile", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysql_globals, mysql_globals) |
c0240cb1 | 11 | PHP_INI_END() |
791b59e4 | 12 | @@ -523,6 +524,7 @@ static PHP_GINIT_FUNCTION(mysql) |
c0240cb1 | 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; | |
791b59e4 | 18 | mysql_globals->allow_local_infile = 1; |
c0240cb1 | 19 | mysql_globals->result_allocated = 0; |
791b59e4 | 20 | @@ -721,6 +723,7 @@ static void php_mysql_do_connect(INTERNA |
c0240cb1 | 21 | { |
22 | char *user=NULL, *passwd=NULL, *host_and_port=NULL, *socket=NULL, *tmp=NULL, *host=NULL; | |
fdbf13b1 | 23 | int user_len = 0, passwd_len = 0, host_len = 0; |
c0240cb1 | 24 | + char *connect_charset=NULL; |
25 | char *hashed_details=NULL; | |
26 | int hashed_details_length, port = MYSQL_PORT; | |
fdbf13b1 | 27 | long client_flags = 0; |
791b59e4 JR |
28 | @@ -744,6 +747,7 @@ static void php_mysql_do_connect(INTERNA |
29 | #endif | |
c0240cb1 | 30 | |
31 | connect_timeout = MySG(connect_timeout); | |
32 | + connect_charset = MySG(connect_charset); | |
33 | ||
34 | socket = MySG(default_socket); | |
35 | ||
791b59e4 | 36 | @@ -885,6 +889,10 @@ static void php_mysql_do_connect(INTERNA |
c0240cb1 | 37 | if (connect_timeout != -1) { |
38 | mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); | |
39 | } | |
40 | + | |
41 | + if (connect_charset != NULL) | |
42 | + mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, connect_charset); | |
43 | + | |
44 | #ifndef MYSQL_USE_MYSQLND | |
45 | if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) | |
46 | #else | |
791b59e4 JR |
47 | @@ -933,6 +941,8 @@ static void php_mysql_do_connect(INTERNA |
48 | #endif | |
c0240cb1 | 49 | if (mysql_ping(mysql->conn)) { |
50 | if (mysql_errno(mysql->conn) == 2006) { | |
51 | + if (connect_charset != NULL) | |
52 | + mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, connect_charset); | |
53 | #ifndef MYSQL_USE_MYSQLND | |
54 | if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) | |
55 | #else | |
791b59e4 JR |
56 | @@ -1012,6 +1022,9 @@ static void php_mysql_do_connect(INTERNA |
57 | mysql_options(mysql->conn, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&connect_timeout); | |
58 | } | |
c0240cb1 | 59 | |
60 | + if (connect_charset != NULL) | |
61 | + mysql_options(mysql->conn, MYSQL_SET_CHARSET_NAME, connect_charset); | |
62 | + | |
63 | #ifndef MYSQL_USE_MYSQLND | |
791b59e4 | 64 | if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL) |
c0240cb1 | 65 | #else |
791b59e4 JR |
66 | diff -urNp -x '*.orig' php-5.6.40.org/ext/mysql/php_mysql_structs.h php-5.6.40/ext/mysql/php_mysql_structs.h |
67 | --- php-5.6.40.org/ext/mysql/php_mysql_structs.h 2019-01-09 10:54:13.000000000 +0100 | |
68 | +++ php-5.6.40/ext/mysql/php_mysql_structs.h 2021-08-23 23:19:37.539114406 +0200 | |
69 | @@ -118,6 +118,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mysql) | |
c0240cb1 | 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; |