From f320c675348940a3ea1dbef2daf4147896ff5614 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 3 Nov 2016 12:05:07 +0100 Subject: [PATCH] Avoid choking on non-string constraints, fixes #5807 --- src/Composer/Package/Loader/ArrayLoader.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Package/Loader/ArrayLoader.php b/src/Composer/Package/Loader/ArrayLoader.php index 10ad4376a..f7e607085 100644 --- a/src/Composer/Package/Loader/ArrayLoader.php +++ b/src/Composer/Package/Loader/ArrayLoader.php @@ -232,6 +232,9 @@ class ArrayLoader implements LoaderInterface { $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 {