1
0
Fork 0

Disallow overriding commands with scripts

pull/3263/head
Jordi Boggiano 2014-09-05 17:28:50 +01:00
parent ca8ce161e1
commit a8adbfeb9f
2 changed files with 8 additions and 4 deletions

View File

@ -89,12 +89,12 @@ EOT
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH'));
}
$args = $input->getArguments();
$args = $input->getArgument('args');
if (in_array($script, $this->commandEvents)) {
return $composer->getEventDispatcher()->dispatchCommandEvent($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
return $composer->getEventDispatcher()->dispatchCommandEvent($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
}
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
}
}

View File

@ -117,11 +117,15 @@ class Application extends BaseApplication
if (isset($composer['scripts']) && is_array($composer['scripts'])) {
foreach ($composer['scripts'] as $script => $dummy) {
if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
if ($this->has($script)) {
$output->writeln('<warning>A script named '.$script.' would override a native Composer function and has been skipped</warning>');
} else {
$this->add(new Command\ScriptAliasCommand($script));
}
}
}
}
}
if ($input->hasParameterOption('--profile')) {
$startTime = microtime(true);