summaryrefslogtreecommitdiff
path: root/ext/bcmath
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2004-07-14 00:14:43 +0000
committerSara Golemon <pollita@php.net>2004-07-14 00:14:43 +0000
commitc4bf45e39ad40ca4de34558e5d9b3a61ed97eab4 (patch)
treec0ce3345caa4457afd3c5eeaddcf03e6899a1296 /ext/bcmath
parent2ec89aa8e1f159ee0461886744dc0f4da4276c15 (diff)
downloadphp-git-c4bf45e39ad40ca4de34558e5d9b3a61ed97eab4.tar.gz
Bugfix# 28829 bcmath values for 0, 1, and 2 initialized/freed at wrong time for threaded sapis.
Diffstat (limited to 'ext/bcmath')
-rw-r--r--ext/bcmath/bcmath.c30
-rw-r--r--ext/bcmath/php_bcmath.h2
2 files changed, 25 insertions, 7 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index b4f5de75e5..94d3b90d59 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -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;
}
/* }}} */
@@ -96,15 +94,33 @@ PHP_MINIT_FUNCTION(bcmath)
*/
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
*/
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index 32d005e226..c99fd2534c 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -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);