]> granicus.if.org Git - php/commitdiff
Bugfix# 28829 bcmath values for 0, 1, and 2 initialized/freed at wrong time for threa...
authorSara Golemon <pollita@php.net>
Wed, 14 Jul 2004 00:14:43 +0000 (00:14 +0000)
committerSara Golemon <pollita@php.net>
Wed, 14 Jul 2004 00:14:43 +0000 (00:14 +0000)
NEWS
ext/bcmath/bcmath.c
ext/bcmath/php_bcmath.h

diff --git a/NEWS b/NEWS
index 97c484c342d3ed954a453bf70e7c6881fe99336a..2a57e828b3e2a408c10b4d922bd0a694a3bf5d80 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2004, PHP 5.0.1
+- Fixed bug #28829 (Thread-unsafety in bcmath elementary values). (Sara)
 
 13 Jul 2004, PHP 5.0.0
 - Updated PCRE to provide better error handling in certain cases. (Andrei)
index b4f5de75e5eee64dd4f2bc2f6f36f7e05f1d8b66..94d3b90d593caacb3586ab0672d25733aa5706e3 100644 (file)
@@ -53,8 +53,8 @@ zend_module_entry bcmath_module_entry = {
        bcmath_functions,
        PHP_MINIT(bcmath),
        PHP_MSHUTDOWN(bcmath),
-       NULL,
-       NULL,
+       PHP_RINIT(bcmath),
+       PHP_RSHUTDOWN(bcmath),
        PHP_MINFO(bcmath),
        NO_VERSION_YET,
        STANDARD_MODULE_PROPERTIES
@@ -86,8 +86,6 @@ PHP_MINIT_FUNCTION(bcmath)
 
        REGISTER_INI_ENTRIES();
 
-       bc_init_numbers(TSRMLS_C);
-
        return SUCCESS;
 }
 /* }}} */
@@ -95,16 +93,34 @@ PHP_MINIT_FUNCTION(bcmath)
 /* {{{ PHP_MSHUTDOWN_FUNCTION
  */
 PHP_MSHUTDOWN_FUNCTION(bcmath)
+{
+       UNREGISTER_INI_ENTRIES();
+
+       return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_RINIT_FUNCTION
+ */
+PHP_RINIT_FUNCTION(bcmath)
+{
+       bc_init_numbers(TSRMLS_C);
+
+       return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_RSHUTDOWN_FUNCTION
+ */
+PHP_RSHUTDOWN_FUNCTION(bcmath)
 {
        _bc_free_num_ex(&BCG(_zero_), 1);
        _bc_free_num_ex(&BCG(_one_), 1);
        _bc_free_num_ex(&BCG(_two_), 1);
 
-       UNREGISTER_INI_ENTRIES();
-
        return SUCCESS;
 }
-/* }}} */
+/* }}} */      
          
 /* {{{ PHP_MINFO_FUNCTION
  */
index 32d005e22668c8e90c1771faaffec8d45a343974..c99fd2534c7e42512abe622fab4c90dfceb5581c 100644 (file)
@@ -30,6 +30,8 @@ extern zend_module_entry bcmath_module_entry;
 
 PHP_MINIT_FUNCTION(bcmath);
 PHP_MSHUTDOWN_FUNCTION(bcmath);
+PHP_RINIT_FUNCTION(bcmath);
+PHP_RSHUTDOWN_FUNCTION(bcmath);
 PHP_MINFO_FUNCTION(bcmath);
 
 PHP_FUNCTION(bcadd);