From 4a02768591d04e28c21bd675635e74246e8602ec Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 9 Sep 2020 11:44:05 +0200 Subject: [PATCH] Fail hard if an invalid root alias is detected --- src/Composer/Package/Loader/RootPackageLoader.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 2115d7378..32118b113 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -190,6 +190,8 @@ class RootPackageLoader extends ArrayLoader 'alias' => $match[2], 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion), ); + } elseif (strpos($reqVersion, ' as ') !== false) { + throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".'); } }