helly           Sat May  1 16:34:15 2004 EDT

  Modified files:              
    /php-src/ext/standard       dl.c 
  Log:
  Don't load modules twice
  
http://cvs.php.net/diff.php/php-src/ext/standard/dl.c?r1=1.88&r2=1.89&ty=u
Index: php-src/ext/standard/dl.c
diff -u php-src/ext/standard/dl.c:1.88 php-src/ext/standard/dl.c:1.89
--- php-src/ext/standard/dl.c:1.88      Sat Feb 14 14:02:23 2004
+++ php-src/ext/standard/dl.c   Sat May  1 16:34:15 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: dl.c,v 1.88 2004/02/14 19:02:23 jan Exp $ */
+/* $Id: dl.c,v 1.89 2004/05/01 20:34:15 helly Exp $ */
 
 #include "php.h"
 #include "dl.h"
@@ -108,6 +108,8 @@
        zend_module_entry *(*get_module)(void);
        int error_type;
        char *extension_dir;
+       int name_len;
+       char *lcname;
 
        if (type==MODULE_PERSISTENT) {
                /* Use the configuration hash directly, the INI mechanism is not yet 
initialized */
@@ -234,6 +236,15 @@
                        DL_UNLOAD(handle);
                        RETURN_FALSE;
        }
+       name_len = strlen(module_entry->name);
+       lcname = zend_str_tolower_dup(module_entry->name, name_len);
+       if (zend_hash_exists(&module_registry, lcname, name_len+1)) {
+               efree(lcname);
+               php_error_docref(NULL TSRMLS_CC, error_type, "Module '%s' already 
loaded", module_entry->name);
+               DL_UNLOAD(handle);
+               RETURN_FALSE;
+       }
+       efree(lcname);
        Z_TYPE_P(module_entry) = type;
        module_entry->module_number = zend_next_free_module();
        if (module_entry->module_startup_func) {

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

Reply via email to