abies           Wed Jan 21 05:22:05 2004 EDT

  Modified files:              
    /php-src/ext/interbase      interbase.c 
  Log:
  MFB
  
  
http://cvs.php.net/diff.php/php-src/ext/interbase/interbase.c?r1=1.193&r2=1.194&ty=u
Index: php-src/ext/interbase/interbase.c
diff -u php-src/ext/interbase/interbase.c:1.193 php-src/ext/interbase/interbase.c:1.194
--- php-src/ext/interbase/interbase.c:1.193     Mon Jan 12 15:03:49 2004
+++ php-src/ext/interbase/interbase.c   Wed Jan 21 05:22:04 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: interbase.c,v 1.193 2004/01/12 20:03:49 abies Exp $ */
+/* $Id: interbase.c,v 1.194 2004/01/21 10:22:04 abies Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -26,7 +26,7 @@
 
 #include "php.h"
 
-#define FILE_REVISION "$Revision: 1.193 $"
+#define FILE_REVISION "$Revision: 1.194 $"
 
 #if HAVE_IBASE
 
@@ -696,6 +696,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;
 }

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

Reply via email to