Skip to content

Commit

Permalink
Avoid choking on non-string constraints, fixes composer#5807
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 3, 2016
1 parent e32c09e commit f320c67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Composer/Package/Loader/ArrayLoader.php
Expand Up @@ -232,6 +232,9 @@ public function parseLinks($source, $sourceVersion, $description, $links)
{
$res = array();
foreach ($links as $target => $constraint) {
if (!is_string($constraint)) {
throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
}
if ('self.version' === $constraint) {
$parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
} else {
Expand Down

0 comments on commit f320c67

Please sign in to comment.