]> git.mxchange.org Git - core.git/commitdiff
Fixed double-loading of classes
authorRoland Häder <roland@mxchange.org>
Tue, 9 Dec 2008 19:24:44 +0000 (19:24 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 9 Dec 2008 19:24:44 +0000 (19:24 +0000)
inc/loader/class_ClassLoader.php

index dbba1ff1139e9ad37d73e6decba8faa95a5c63e2..7adec302499d95eaf0afaee2846e7c54909dff0a 100644 (file)
@@ -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<br />\n";
                        require($this->classes[$fileName]);
                        //* DEBUG: */ echo "LOAD: ".$fileName." - End<br />\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