Created
September 5, 2016 19:20
-
-
Save Nicofuma/55fa830df388fce56058850f9341ee41 to your computer and use it in GitHub Desktop.
Patch to skip invalid packages in cmposer repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php | |
index 78ef743..d91d471 100644 | |
--- a/src/Composer/Repository/ComposerRepository.php | |
+++ b/src/Composer/Repository/ComposerRepository.php | |
@@ -343,6 +343,7 @@ public function whatProvides(Pool $pool, $name, $bypassFilters = false) | |
$this->providers[$name] = array(); | |
foreach ($packages['packages'] as $versions) { | |
foreach ($versions as $version) { | |
+ try { | |
// avoid loading the same objects twice | |
if (isset($this->providersByUid[$version['uid']])) { | |
// skip if already assigned | |
@@ -399,6 +400,9 @@ public function whatProvides(Pool $pool, $name, $bypassFilters = false) | |
$this->providersByUid[$version['uid'] . '-root'] = $alias; | |
} | |
} | |
+ } catch (\RuntimeException $e) { | |
+ $this->io->writeError('Could not load a package: '. $e->getMessage()); | |
+ } | |
} | |
} | |
@@ -426,7 +430,11 @@ protected function initialize() | |
$repoData = $this->loadDataFromServer(); | |
foreach ($repoData as $package) { | |
+ try { | |
$this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage')); | |
+ } catch (\RuntimeException $e) { | |
+ $this->io->writeError('Could not load a package: '. $e->getMessage()); | |
+ } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment