Dont double load class

If the class already exists we should not load it twice. Since the composer autoloader is also used in core this could otherwise load a file twice.

This leads to problems otherwise with case insensitive operating systems like OS X. We can get rid of this once all file names in OC follow PSR-4, until then we probably need this check.
This commit is contained in:
Lukas Reschke 2016-03-22 16:15:02 +01:00
parent ffe57a55d9
commit 8e72e51b21
1 changed files with 4 additions and 0 deletions

View File

@ -164,6 +164,10 @@ class Autoloader {
$pathsToRequire = $this->memoryCache->get($class);
}
if(class_exists($class, false)) {
return false;
}
if (!is_array($pathsToRequire)) {
// No cache or cache miss
$pathsToRequire = array();