From: Zeev Suraski Date: Sat, 18 Nov 2000 02:59:31 +0000 (+0000) Subject: Fix thread-safety bug in bcmath X-Git-Tag: php-4.0.4RC3~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66c667c9741fe839f283848c89d7e4c454fd12bf;p=php Fix thread-safety bug in bcmath --- diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 4ec3f1d798..78a2521b8c 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -42,10 +42,10 @@ function_entry bcmath_functions[] = { zend_module_entry bcmath_module_entry = { "bcmath", bcmath_functions, - NULL, - NULL, + PHP_MINIT(bcmath), + PHP_MSHUTDOWN(bcmath), PHP_RINIT(bcmath), - PHP_RSHUTDOWN(bcmath), + NULL, PHP_MINFO(bcmath), STANDARD_MODULE_PROPERTIES }; @@ -58,21 +58,30 @@ ZEND_GET_MODULE(bcmath) static long bc_precision; #endif -PHP_RINIT_FUNCTION(bcmath) +PHP_MINIT_FUNCTION(bcmath) { init_numbers(); - if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) { - bc_precision=0; - } return SUCCESS; } -PHP_RSHUTDOWN_FUNCTION(bcmath) + + +PHP_MSHUTDOWN_FUNCTION(bcmath) { destruct_numbers(); return SUCCESS; } + +PHP_RINIT_FUNCTION(bcmath) +{ + if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) { + bc_precision=0; + } + return SUCCESS; +} + + PHP_MINFO_FUNCTION(bcmath) { php_info_print_table_start(); diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h index df7512d842..724484743a 100644 --- a/ext/bcmath/php_bcmath.h +++ b/ext/bcmath/php_bcmath.h @@ -26,8 +26,9 @@ extern zend_module_entry bcmath_module_entry; #define phpext_bcmath_ptr &bcmath_module_entry -extern PHP_RINIT_FUNCTION(bcmath); -extern PHP_RSHUTDOWN_FUNCTION(bcmath); +PHP_MINIT_FUNCTION(bcmath); +PHP_MSHUTDOWN_FUNCTION(bcmath); +PHP_RINIT_FUNCTION(bcmath); PHP_MINFO_FUNCTION(bcmath); PHP_FUNCTION(bcadd);