Skip to content

Commit

Permalink
Fix #10935 in a more generic way which fixes the issue for all Factor…
Browse files Browse the repository at this point in the history
…y::create usages
  • Loading branch information
Seldaek committed Jul 13, 2022
1 parent 37a7889 commit 0e59fbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Composer/Command/CreateProjectCommand.php
Expand Up @@ -403,7 +403,7 @@ protected function installRootPackage(IOInterface $io, Config $config, $packageN
throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
}

$composer = Factory::create($io, $config->all(), $disablePlugins === true ? true : 'local', $disableScripts);
$composer = Factory::create($io, $config->all(), $disablePlugins, $disableScripts);
$config = $composer->getConfig();
$rm = $composer->getRepositoryManager();

Expand Down
8 changes: 8 additions & 0 deletions src/Composer/Factory.php
Expand Up @@ -646,6 +646,14 @@ public static function create(IOInterface $io, $config = null, $disablePlugins =
{
$factory = new static();

// for BC reasons, if a config is passed in either as array or a path that is not the default composer.json path
// we disable local plugins as they really should not be loaded from CWD
// If you want to avoid this behavior, you should be calling createComposer directly with a $cwd arg set correctly
// to the path where the composer.json being loaded resides
if ($config !== null && $config !== self::getComposerFile() && $disablePlugins === false) {
$disablePlugins = 'local';
}

return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
}

Expand Down

0 comments on commit 0e59fbb

Please sign in to comment.