]> git.pld-linux.org Git - packages/php.git/blame - php-pdo_mysql-charsetphpini.patch
Release 15 (by relup.sh)
[packages/php.git] / php-pdo_mysql-charsetphpini.patch
CommitLineData
c0240cb1 1This is damn ugly patch if you need to update it, see PHP_5_2 branch version to
2understand what this patch is supposed to do as in 5.3 the ini section is
3enabled only if mysqlnd driver is enabled which makes the contexts really
4small.
5
791b59e4
JR
6diff -urNp -x '*.orig' php-5.6.40.org/ext/pdo_mysql/mysql_driver.c php-5.6.40/ext/pdo_mysql/mysql_driver.c
7--- php-5.6.40.org/ext/pdo_mysql/mysql_driver.c 2019-01-09 10:54:13.000000000 +0100
8+++ php-5.6.40/ext/pdo_mysql/mysql_driver.c 2021-08-23 23:19:43.115775250 +0200
9@@ -539,6 +539,7 @@ static int pdo_mysql_handle_factory(pdo_
c0240cb1 10 pdo_mysql_db_handle *H;
11 int i, ret = 0;
12 char *host = NULL, *unix_socket = NULL;
13+ char *connect_charset = NULL;
14 unsigned int port = 3306;
15 char *dbname;
16 struct pdo_data_src_parser vars[] = {
791b59e4 17@@ -764,6 +765,12 @@ static int pdo_mysql_handle_factory(pdo_
c0240cb1 18 password_len = strlen(dbh->password);
19 }
20
21+ connect_charset = PDO_MYSQL_G(connect_charset);
22+
23+ if (connect_charset != NULL) {
24+ mysql_options(H->server, MYSQL_SET_CHARSET_NAME, connect_charset);
25+ }
26+
27 if (mysqlnd_connect(H->server, host, dbh->username, dbh->password, password_len, dbname, dbname_len,
791b59e4 28 port, unix_socket, connect_opts, MYSQLND_CLIENT_NO_FLAG TSRMLS_CC) == NULL) {
c0240cb1 29 #else
791b59e4
JR
30diff -urNp -x '*.orig' php-5.6.40.org/ext/pdo_mysql/pdo_mysql.c php-5.6.40/ext/pdo_mysql/pdo_mysql.c
31--- php-5.6.40.org/ext/pdo_mysql/pdo_mysql.c 2019-01-09 10:54:13.000000000 +0100
32+++ php-5.6.40/ext/pdo_mysql/pdo_mysql.c 2021-08-23 23:19:43.115775250 +0200
33@@ -95,6 +95,7 @@ PHP_INI_BEGIN()
c0240cb1 34 #if PDO_DBG_ENABLED
35 STD_PHP_INI_ENTRY("pdo_mysql.debug", NULL, PHP_INI_SYSTEM, OnUpdateString, debug, zend_pdo_mysql_globals, pdo_mysql_globals)
36 #endif
37+ STD_PHP_INI_ENTRY("pdo_mysql.connect_charset", NULL, PHP_INI_ALL, OnUpdateString, connect_charset, zend_pdo_mysql_globals, pdo_mysql_globals)
38 PHP_INI_END()
39 /* }}} */
40
791b59e4 41@@ -141,9 +142,7 @@ static PHP_MINIT_FUNCTION(pdo_mysql)
c0240cb1 42 static PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
43 {
44 php_pdo_unregister_driver(&pdo_mysql_driver);
45-#if PDO_USE_MYSQLND
46 UNREGISTER_INI_ENTRIES();
47-#endif
48
49 return SUCCESS;
50 }
791b59e4 51@@ -213,6 +212,7 @@ static PHP_GINIT_FUNCTION(pdo_mysql)
c0240cb1 52 pdo_mysql_globals->debug = NULL; /* The actual string */
53 pdo_mysql_globals->dbg = NULL; /* The DBG object*/
54 #endif
55+ pdo_mysql_globals->connect_charset = NULL;
56 }
57 /* }}} */
58
791b59e4
JR
59diff -urNp -x '*.orig' php-5.6.40.org/ext/pdo_mysql/php_pdo_mysql_int.h php-5.6.40/ext/pdo_mysql/php_pdo_mysql_int.h
60--- php-5.6.40.org/ext/pdo_mysql/php_pdo_mysql_int.h 2019-01-09 10:54:13.000000000 +0100
61+++ php-5.6.40/ext/pdo_mysql/php_pdo_mysql_int.h 2021-08-23 23:19:43.115775250 +0200
62@@ -72,6 +72,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pdo_mysql)
c0240cb1 63 char *debug; /* The actual string */
64 MYSQLND_DEBUG *dbg; /* The DBG object */
65 #endif
66+ char *connect_charset;
67 #if defined(PHP_WIN32) && !PDO_DBG_ENABLED
68 /* dummy member so we get at least one member in the struct
69 * and avoids build errors.
This page took 0.041286 seconds and 4 git commands to generate.