abies           Wed Jan 21 05:12:20 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/interbase      interbase.c 
    /php-src    NEWS 
  Log:
  Fixed bug #26968 (Segfault with Interbase module built as shared)
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.91.2.27&r2=1.91.2.28&ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.91.2.27 
php-src/ext/interbase/interbase.c:1.91.2.28
--- php-src/ext/interbase/interbase.c:1.91.2.27 Wed Jan  7 04:44:21 2004
+++ php-src/ext/interbase/interbase.c   Wed Jan 21 05:12:14 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: interbase.c,v 1.91.2.27 2004/01/07 09:44:21 abies Exp $ */
+/* $Id: interbase.c,v 1.91.2.28 2004/01/21 10:12:14 abies Exp $ */
 
 
 /* TODO: Arrays, roles?
@@ -594,6 +594,25 @@
 
 PHP_MSHUTDOWN_FUNCTION(ibase)
 {
+#ifndef PHP_WIN32
+       /**
+        * When the Interbase client API library libgds.so is first loaded, it 
registers a call to 
+        * gds__cleanup() with atexit(), in order to clean up after itself when the 
process exits.
+        * This means that the library is called at process shutdown, and cannot be 
unloaded beforehand.
+        * PHP tries to unload modules after every request [dl()'ed modules], and 
right before the 
+        * process shuts down [modules loaded from php.ini]. This results in a 
segfault for this module.
+        * By NULLing the dlopen() handle in the module entry, Zend omits the call to 
dlclose(),
+        * ensuring that the module will remain present until the process exits. 
However, the functions
+        * and classes exported by the module will not be available until the module 
is 'reloaded'. 
+        * When reloaded, dlopen() will return the handle of the already loaded 
module. The module will
+        * be unloaded automatically when the process exits.
+        */
+       zend_module_entry *ibase_entry;
+       if (SUCCESS == zend_hash_find(&module_registry, ibase_module_entry.name, 
strlen(ibase_module_entry.name) +1, (void*) &ibase_entry))
+       {
+               ibase_entry->handle = NULL;
+       }
+#endif
        UNREGISTER_INI_ENTRIES();
        return SUCCESS;
 }
@@ -624,7 +643,7 @@
 
        php_info_print_table_start();
        php_info_print_table_row(2, "Interbase Support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.91.2.27 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.91.2.28 $");
 #ifdef COMPILE_DL_INTERBASE
        php_info_print_table_row(2, "Dynamic Module", "yes");
 #endif
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.537&r2=1.1247.2.538&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.537 php-src/NEWS:1.1247.2.538
--- php-src/NEWS:1.1247.2.537   Tue Jan 20 23:00:46 2004
+++ php-src/NEWS        Wed Jan 21 05:12:17 2004
@@ -5,6 +5,7 @@
   safe_mode/open_basedir). (Ilia)
 - Fixed bug #26973 (*printf() '+' modifier broken). (Jani)
 - Fixed bug #26969 (--with-openssl=shared build fails). (Jani)
+- Fixed bug #26968 (Segfault with Interbase module built as shared). (Ard)
 - Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled). (Jani)
 - Fixed bug #26937 (Warning in xml.c). (Jani)
 - Fixed Bug #26927 (preg_quote() does not escape \0). (Ilia)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to