From 18895064ad12bbe165221029f166eff368e4e833 Mon Sep 17 00:00:00 2001 From: Mike van Rooyen Date: Tue, 8 Oct 2019 15:46:35 +0100 Subject: [PATCH] Check that if the getUrlMatches method returns an empty value which means the path is incorrect --- src/Composer/Repository/PathRepository.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 6e218f159..d5d21b609 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -125,7 +125,13 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn { parent::initialize(); - foreach ($this->getUrlMatches() as $url) { + $urlMatches = $this->getUrlMatches(); + + if (empty($urlMatches)) { + throw new \RuntimeException('The `url` supplied for the path repository does not exist'); + } + + foreach ($urlMatches as $url) { $path = realpath($url) . DIRECTORY_SEPARATOR; $composerFilePath = $path.'composer.json';