Browse Source

move $length variable outsite foreach (#6828)

the `foreach` over the `prefixDirsPsr4[$search]` won't affect `$length`. 

It's used for the offset of `$logicalPathPsr4`.
Pedro de Carvalho 7 years ago
parent
commit
f569833f5a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/Composer/Autoload/ClassLoader.php

+ 1 - 1
src/Composer/Autoload/ClassLoader.php

@@ -379,8 +379,8 @@ class ClassLoader
                 $subPath = substr($subPath, 0, $lastPos);
                 $search = $subPath.'\\';
                 if (isset($this->prefixDirsPsr4[$search])) {
+                    $length = $this->prefixLengthsPsr4[$first][$search];
                     foreach ($this->prefixDirsPsr4[$search] as $dir) {
-                        $length = $this->prefixLengthsPsr4[$first][$search];
                         if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
                             return $file;
                         }