mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #41350 (my_thread_global_end() error during request shutdown on Windows).
This commit is contained in:
parent
305ae11a3f
commit
99c875a03d
3 changed files with 48 additions and 0 deletions
|
@ -401,6 +401,10 @@ ZEND_MODULE_STARTUP_D(mysql)
|
|||
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_INTERACTIVE", CLIENT_INTERACTIVE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
if (mysql_server_init(0, NULL, NULL)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -409,6 +413,16 @@ ZEND_MODULE_STARTUP_D(mysql)
|
|||
*/
|
||||
PHP_MSHUTDOWN_FUNCTION(mysql)
|
||||
{
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long client_ver = mysql_get_client_version;
|
||||
/* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
|
||||
if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
|
||||
mysql_server_end();
|
||||
}
|
||||
#else
|
||||
mysql_server_end();
|
||||
#endif
|
||||
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -418,12 +432,18 @@ PHP_MSHUTDOWN_FUNCTION(mysql)
|
|||
*/
|
||||
PHP_RINIT_FUNCTION(mysql)
|
||||
{
|
||||
#ifdef ZTS
|
||||
if (mysql_thread_init()) {
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
MySG(default_link)=-1;
|
||||
MySG(num_links) = MySG(num_persistent);
|
||||
/* Reset connect error/errno on every request */
|
||||
MySG(connect_error) = NULL;
|
||||
MySG(connect_errno) =0;
|
||||
MySG(result_allocated) = 0;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -432,6 +452,10 @@ PHP_RINIT_FUNCTION(mysql)
|
|||
*/
|
||||
PHP_RSHUTDOWN_FUNCTION(mysql)
|
||||
{
|
||||
#ifdef ZTS
|
||||
mysql_thread_end();
|
||||
#endif
|
||||
|
||||
if (MySG(trace_mode)) {
|
||||
if (MySG(result_allocated)){
|
||||
php_error_docref("function.mysql-free-result" TSRMLS_CC, E_WARNING, "%lu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue