From e89d16c47d5094191ca7723e14d979c0ec41f9a9 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 18 Jul 2018 16:00:32 +0200 Subject: [PATCH 1/2] GLOB_BRACE is not defined on all platforms --- 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 c6e0bb39d..8b9850c77 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -174,9 +174,15 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn */ private function getUrlMatches() { + $flags = GLOB_MARK | GLOB_ONLYDIR; + + if (defined('GLOB_BRACE')) { + $flags |= GLOB_BRACE; + } + // Ensure environment-specific path separators are normalized to URL separators return array_map(function ($val) { return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/'); - }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR | GLOB_BRACE)); + }, glob($this->url, $flags)); } } From 70a1a6e5103bc8515e5d71fc529185ee15948cd6 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 18 Jul 2018 16:38:44 +0200 Subject: [PATCH 2/2] Throw a RuntimeException when glob braces are used but not supported by the OS --- src/Composer/Repository/PathRepository.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 8b9850c77..5d50c2473 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -178,6 +178,8 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn if (defined('GLOB_BRACE')) { $flags |= GLOB_BRACE; + } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) { + throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url); } // Ensure environment-specific path separators are normalized to URL separators