浏览代码

Merge pull request #5984 from composer/revert-5974-allow-parent-path-repository

Revert "Allow use of parent directories in PathDownloader when not mirroring the path"
Jordi Boggiano 8 年之前
父节点
当前提交
324c31f4a7
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      src/Composer/Downloader/PathDownloader.php

+ 7 - 7
src/Composer/Downloader/PathDownloader.php

@@ -45,6 +45,13 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
             ));
         }
 
+        if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
+            throw new \RuntimeException(sprintf(
+                'Package %s cannot install to "%s" inside its source at "%s"',
+                $package->getName(), realpath($path), $realUrl
+            ));
+        }
+
         // Get the transport options with default values
         $transportOptions = $package->getTransportOptions() + array('symlink' => null);
 
@@ -65,13 +72,6 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
             $allowedStrategies = array(self::STRATEGY_MIRROR);
         }
 
-        if ($currentStrategy != self::STRATEGY_MIRROR && strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
-            throw new \RuntimeException(sprintf(
-                'Package %s cannot install to "%s" inside its source at "%s"',
-                $package->getName(), realpath($path), $realUrl
-            ));
-        }
-
         $fileSystem = new Filesystem();
         $this->filesystem->removeDirectory($path);