php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7940 undefined symbol: bc_compare
Submitted: 2000-11-23 06:54 UTC Modified: 2001-04-27 21:31 UTC
From: astmail at yahoo dot com Assigned:
Status: Closed Package: Dynamic loading
PHP Version: 4.0.3pl1 OS: Linux 2.2
Private report: No CVE-ID: None
 [2000-11-23 06:54 UTC] astmail at yahoo dot com
/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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-23 11:36 UTC] astmail at yahoo dot com
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 %s\n", 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 */
==============================================

 [2001-04-27 21:31 UTC] sniper@php.net
Fixed in PHP 4.0.4pl1


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC