Skip to content

Commit

Permalink
Consider disallowed plugin a fatal error
Browse files Browse the repository at this point in the history
  • Loading branch information
damz committed Jul 4, 2022
1 parent c422fef commit 435e0f1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Composer/Plugin/PluginManager.php
Expand Up @@ -156,9 +156,7 @@ public function registerPackage(PackageInterface $package, bool $failOnMissingCl
}

if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin)) {
$this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);

return;
throw new \UnexpectedValueException('Cannot load "'.$package->getName().'"'.($isGlobalPlugin ? ' (installed globally)' : '').' as it is not in config.allow-plugins');
}

if ($package->getType() === 'composer-plugin') {
Expand Down Expand Up @@ -387,9 +385,7 @@ public function addPlugin(PluginInterface $plugin, bool $isGlobalPlugin = false,
if ($sourcePackage === null) {
trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED);
} elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin)) {
$this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG);

return;
throw new \UnexpectedValueException('Cannot load "'.$sourcePackage->getName().'"'.($isGlobalPlugin ? ' (installed globally)' : '').' as it is not in config.allow-plugins');
}

$details = array();
Expand Down

0 comments on commit 435e0f1

Please sign in to comment.