From: Roland Häder Date: Tue, 9 Dec 2008 19:24:44 +0000 (+0000) Subject: Fixed double-loading of classes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9136aa1c38dee10fe9909374f8541bbcae4f7861;p=core.git Fixed double-loading of classes --- diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index dbba1ff1..7adec302 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -303,8 +303,8 @@ class ClassLoader { $fileName = $this->prefix . $className . $this->suffix; // Now look it up in our index - if (isset($this->classes[$fileName])) { - // File is found so load it only once + if ((isset($this->classes[$fileName])) && (!in_array($this->classes[$fileName], $this->loadedClasses))) { + // File is found and not loaded so load it only once //* DEBUG: */ echo "LOAD: ".$fileName." - Start
\n"; require($this->classes[$fileName]); //* DEBUG: */ echo "LOAD: ".$fileName." - End
\n"; @@ -315,6 +315,9 @@ class ClassLoader { // Mark this class as loaded $this->loadedClasses[] = $this->classes[$fileName]; + // Remove it from classes list + unset($this->classes[$fileName]); + // Developer mode excludes caching (better debugging) if (!defined('DEVELOPER')) { // Reset cache