From 5edcc198207e3877e6f40032396bdb5d4a508f42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Mar 2012 15:47:01 +0100 Subject: [PATCH] Add a protection for duplicate modules --- htdocs/admin/modules.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 40b736596a5ed..636b7ee1c852b 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -105,6 +105,7 @@ $dirmod = array(); $i = 0; // is a sequencer of modules found $j = 0; // j is module number. Automatically affected if module number not defined. +$modNameLoaded=array(); foreach ($modulesdir as $dir) { @@ -123,10 +124,18 @@ if ($modName) { + if (in_array($modName,$modNameLoaded)) + { + $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
"; + dol_syslog($mesg, LOG_ERR); + continue; + } + try { $res=include_once($dir.$file); $objMod = new $modName($db); + $modNameLoaded[$modName]=$dir; if ($objMod->numero > 0) {