Prevent require command from allowing a package to require itself, fixes #8247
parent
e7051de1a4
commit
1a391b572c
|
@ -145,7 +145,12 @@ EOT
|
||||||
|
|
||||||
// validate requirements format
|
// validate requirements format
|
||||||
$versionParser = new VersionParser();
|
$versionParser = new VersionParser();
|
||||||
foreach ($requirements as $constraint) {
|
foreach ($requirements as $package => $constraint) {
|
||||||
|
if (strtolower($package) === $composer->getPackage()->getName()) {
|
||||||
|
$io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
$versionParser->parseConstraints($constraint);
|
$versionParser->parseConstraints($constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue