浏览代码

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 年之前
父节点
当前提交
f569833f5a
共有 1 个文件被更改,包括 1 次插入1 次删除
  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;
                         }