From d559bf5387e49b108150bf4683485885cae0f89d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 11 Mar 2020 15:33:14 +0100 Subject: [PATCH] Allow configuring a path repo to an empty path as long as using wildcards and the wildcard root exists, fixes #8679 --- src/Composer/Repository/PathRepository.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 4db774579..5b6a770b2 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -128,6 +128,17 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn $urlMatches = $this->getUrlMatches(); if (empty($urlMatches)) { + if (preg_match('{[*{}]}', $this->url)) { + $url = $this->url; + while (preg_match('{[*{}]}', $url)) { + $url = dirname($url); + } + // the parent directory before any wildcard exists, so we assume it is correctly configured but simply empty + if (is_dir($url)) { + return; + } + } + throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist'); }