ID: 7940 Updated by: sniper Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Dynamic loading PHP Version: 4.0.3pl1 Assigned To: Comments: Fixed in PHP 4.0.4pl1 Previous Comments: --------------------------------------------------------------------------- [2000-11-23 11:36:20] [EMAIL PROTECTED] Quick and dirty patch (allows at least httpsd to be started): ============================================== --- cmp/php-4.0.3pl1/Zend/zend_extensions.c Mon Sep 25 20:10:45 2000 +++ src/php-4.0.3pl1/Zend/zend_extensions.c Thu Nov 23 16:45:08 2000 @@ -23,6 +23,15 @@ ZEND_API zend_llist zend_extensions; static int last_resource_number; +#if ZEND_EXTENSIONS_SUPPORT +#ifdef COMPILE_DL_BCMATH +int (*__bc_compare)(void *n1,void *n2)=NULL; +void (*__str2num)(void *n,char *s,int i)=NULL; +void (*__init_num)(void *n)=NULL; +void (*__free_num)(void *n)=NULL; +#endif +#endif + int zend_load_extensions(char **extension_paths) { char **p = extension_paths; @@ -123,6 +132,17 @@ zend_append_version_info(&extension); /*fprintf(stderr, "Loaded %s, version %sn", extension.name, extension.version);*/ +#ifdef COMPILE_DL_BCMATH + if(!__bc_compare) + { + __bc_compare=DL_FETCH_SYMBOL(handle,"bc_compare"); + __str2num=DL_FETCH_SYMBOL(handle,"str2num"); + __init_num=DL_FETCH_SYMBOL(handle,"init_num"); + __free_num=DL_FETCH_SYMBOL(handle,"free_num"); + if(!__bc_compare||!__str2num||!__init_num||!__free_num) + __bc_compare=NULL; + } +#endif #endif return SUCCESS; --- cmp/php-4.0.3pl1/Zend/zend_operators.c Tue Sep 5 19:55:56 2000 +++ src/php-4.0.3pl1/Zend/zend_operators.c Thu Nov 23 16:43:08 2000 @@ -36,6 +36,15 @@ #include "ext/bcmath/number.h" #endif +#if ZEND_EXTENSIONS_SUPPORT +#ifdef COMPILE_DL_BCMATH +extern int (*__bc_compare)(void *n1,void *n2); +extern void (*__str2num)(void *n,char *s,int i); +extern void (*__init_num)(void *n); +extern void (*__free_num)(void *n); +#endif +#endif + ZEND_API double zend_string_to_double(const char *number, zend_uint length) { double divisor = 10.0; @@ -1568,7 +1577,21 @@ if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1)) && (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2))) { #if WITH_BCMATH - if ((ret1==FLAG_IS_BC) || (ret2==FLAG_IS_BC)) { + if (((ret1==FLAG_IS_BC) || (ret2==FLAG_IS_BC)) +#if ZEND_EXTENSIONS_SUPPORT +#ifdef COMPILE_DL_BCMATH + && __bc_compare +#endif +#endif + ) { +#if ZEND_EXTENSIONS_SUPPORT +#ifdef COMPILE_DL_BCMATH +#define bc_compare(a,b) (*__bc_compare)(a,b) +#define str2num(a,b,c) (*__str2num)(a,b,c) +#define init_num(a) (*__init_num)(a) +#define free_num(a) (*__free_num)(a) +#endif +#endif bc_num first, second; /* use the BC math library to compare the numbers */ ============================================== --------------------------------------------------------------------------- [2000-11-23 06:54:51] [EMAIL PROTECTED] /usr/local/apache/bin/httpsd Syntax error on line 241 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: undefined symbol: bc_compare Excerpt from php compile time configuration: --enable-bcmath=shared Problem: in Zend/zend_operators.c, function zendi_smart_strcmp(), there is an unconditional call to bc_compare when bcmath is built, not taking care of the fact that if the bcmath extension is built as a dso it may be possibly not loaded. Please note: DSOs are very helpful if you do one standard build for a variety of servers and configurations so doing a non-shared build is not a solution. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=7940&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]