diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 95ca80d20..b564cf367 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -351,6 +351,14 @@ class EventDispatcher if ($matched && !file_exists($match[0])) { $finder = new ExecutableFinder; if ($pathToExec = $finder->find($match[0])) { + if (Platform::isWindows()) { + $execWithoutExt = Preg::replace('{\.(exe|bat|cmd|com)$}i', '', $pathToExec); + // prefer non-extension file if it exists when executing with PHP + if (file_exists($execWithoutExt)) { + $pathToExec = $execWithoutExt; + } + unset($execWithoutExt); + } $pathAndArgs = $pathToExec . substr($pathAndArgs, strlen($match[0])); } }