From 92faea0e5fc27ca47d6fa6c18b1da1d6b6cac4a0 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Sun, 9 Sep 2012 13:04:24 +0200
Subject: [PATCH] Load plugins using include_once instead of include

The problem with using include is that when the file that is loaded
does not contain the plugin class (e.g. because the directory name is
wrong), the file could be loaded again when the plugin class is
requested a second time which will lead to a fatal error because of
class redeclaration.
---
 inc/load.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inc/load.php b/inc/load.php
index 8df68d1b3..ddd12b546 100644
--- a/inc/load.php
+++ b/inc/load.php
@@ -101,7 +101,7 @@ function load_autoload($name){
         $c = ((count($m) === 4) ? "/{$m[3]}" : '');
         $plg = DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php";
         if(@file_exists($plg)){
-            include DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php";
+            include_once DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php";
         }
         return;
     }
-- 
GitLab