From d855986c391745ac6e8bdd7b8c731815289e96ef Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 23 Feb 2021 15:23:17 +0100 Subject: [PATCH] Also allow backslashes to work on cmd.exe for plain executable paths, fixes #9707 --- src/Composer/EventDispatcher/EventDispatcher.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index cb77ac9b1..53032f369 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -265,6 +265,12 @@ class EventDispatcher $_SERVER['PHP_BINARY'] = $phpPath; putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']); } + + if (Platform::isWindows()) { + $exec = preg_replace_callback('{^\S+}', function ($path) { + return str_replace('/', '\\', $path[0]); + }, $exec); + } } // if composer is being executed, make sure it runs the expected composer from current path