From 70314f3570247ce9a62934997ea449ec44cd635b Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Fri, 24 Feb 2017 15:27:09 +0000 Subject: [PATCH 1/3] Fix Repository support for Subversion 1.8.x where the output of svn info has changed. 1.7.22 svn: E170001: Unable to connect to a repository at URL 'https://svswdms02/dashboard' svn: E170001: OPTIONS of 'https://svswdms02/dashboard': authorization failed: Could not authenticate to server: rejected Digest challenge (https://svswdms02) 1.8.17 svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option svn: E215004: Unable to connect to a repository at URL 'https://svswdms02/dashboard' svn: E215004: No more credentials or we tried too many times. Authentication failed --- src/Composer/Repository/Vcs/SvnDriver.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index f2d6a4754..ffc7183f7 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -301,12 +301,20 @@ class SvnDriver extends VcsDriver return true; } + // Subversion client 1.7 and older if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) { // This is likely a remote Subversion repository that requires // authentication. We will handle actual authentication later. return true; } + // Subversion client 1.8 and newer + if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) { + // This is likely a remote Subversion or newer repository that requires + // authentication. We will handle actual authentication later. + return true; + } + return false; } From f85a4a2f5135d813a14c8042ff7bcf1261de11fc Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 6 Mar 2017 16:17:49 +0100 Subject: [PATCH 2/3] Add notice about not trying to allow path symlinks into source dir, refs #5974, refs #6174 --- src/Composer/Downloader/PathDownloader.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Composer/Downloader/PathDownloader.php b/src/Composer/Downloader/PathDownloader.php index cde32f4a6..79b687985 100644 --- a/src/Composer/Downloader/PathDownloader.php +++ b/src/Composer/Downloader/PathDownloader.php @@ -46,6 +46,10 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter } if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) { + // IMPORTANT NOTICE: If you wish to change this, don't. You are wasting your time and ours. + // + // Please see https://github.com/composer/composer/pull/5974 and https://github.com/composer/composer/pull/6174 + // for previous attempts that were shut down because they did not work well enough or introduced too many risks. throw new \RuntimeException(sprintf( 'Package %s cannot install to "%s" inside its source at "%s"', $package->getName(), realpath($path), $realUrl From e6d648f46569be1442ccd05f7555fc77b74e684f Mon Sep 17 00:00:00 2001 From: David WATTIER Date: Sun, 26 Feb 2017 22:22:44 +0100 Subject: [PATCH 3/3] Improve performance on psr4 autoload file finding --- src/Composer/Autoload/ClassLoader.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index 4626994fd..2c72175e7 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -374,9 +374,13 @@ class ClassLoader $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; }