scottmac                Mon Jun 25 16:01:30 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/mysql  php_mysql.c 
    /php-src/ext/mysqli mysqli.c 
  Log:
  Fixed bug #41350 (my_thread_global_end() error during request shutdown on 
Windows).
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.796&r2=1.2027.2.547.2.797&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.796 php-src/NEWS:1.2027.2.547.2.797
--- php-src/NEWS:1.2027.2.547.2.796     Sun Jun 24 17:37:01 2007
+++ php-src/NEWS        Mon Jun 25 16:01:29 2007
@@ -76,6 +76,8 @@
 - Fixed bug #41527 (WDDX deserialize numeric string array key). (Matt, Ilia)
 - Fixed bug #41518 (file_exists() warns of open_basedir restriction on 
   non-existent file). (Tony)
+- Fixed bug #41350 (my_thread_global_end() error during request shutdown
+  on Windows). (Scott, Andrey)
 - Fixed bug #39330 (apache2handler does not call shutdown actions before 
   apache child die). (isk at ecommerce dot com, Gopal, Tony)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.213.2.6.2.14&r2=1.213.2.6.2.15&diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.213.2.6.2.14 
php-src/ext/mysql/php_mysql.c:1.213.2.6.2.15
--- php-src/ext/mysql/php_mysql.c:1.213.2.6.2.14        Mon Jun 18 21:51:32 2007
+++ php-src/ext/mysql/php_mysql.c       Mon Jun 25 16:01:30 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
  
-/* $Id: php_mysql.c,v 1.213.2.6.2.14 2007/06/18 21:51:32 stas Exp $ */
+/* $Id: php_mysql.c,v 1.213.2.6.2.15 2007/06/25 16:01:30 scottmac Exp $ */
 
 /* TODO:
  *
@@ -401,6 +401,10 @@
        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 @@
  */
 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_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_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));
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.15&r2=1.72.2.16.2.16&diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.15 
php-src/ext/mysqli/mysqli.c:1.72.2.16.2.16
--- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.15  Tue Mar 20 20:00:27 2007
+++ php-src/ext/mysqli/mysqli.c Mon Jun 25 16:01:30 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.72.2.16.2.15 2007/03/20 20:00:27 helly Exp $ 
+  $Id: mysqli.c,v 1.72.2.16.2.16 2007/06/25 16:01:30 scottmac Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -652,6 +652,10 @@
        REGISTER_LONG_CONSTANT("MYSQLI_REPORT_ALL", MYSQLI_REPORT_ALL, CONST_CS 
| CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("MYSQLI_REPORT_OFF", 0, CONST_CS | 
CONST_PERSISTENT);
 
+       if (mysql_server_init(0, NULL, NULL)) {
+               return FAILURE;
+       }
+
        return SUCCESS;
 }
 /* }}} */
@@ -660,6 +664,16 @@
  */
 PHP_MSHUTDOWN_FUNCTION(mysqli)
 {
+#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
+
        zend_hash_destroy(&mysqli_driver_properties);
        zend_hash_destroy(&mysqli_result_properties);
        zend_hash_destroy(&mysqli_stmt_properties);
@@ -676,6 +690,11 @@
  */
 PHP_RINIT_FUNCTION(mysqli)
 {
+#ifdef ZTS
+       if (mysql_thread_init()) {
+               return FAILURE;
+       }
+#endif
        MyG(error_msg) = NULL;
        MyG(error_no) = 0;
 
@@ -687,6 +706,9 @@
  */
 PHP_RSHUTDOWN_FUNCTION(mysqli)
 {
+#ifdef ZTS
+       mysql_thread_end();
+#endif
        if (MyG(error_msg)) {
                efree(MyG(error_msg));
        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to