1
0
Fork 0

Fix EventDispatcher on windows picking bat files when using "@php binary", fixes #11490

pull/11500/head
Jordi Boggiano 2023-06-07 15:19:44 +02:00
parent 902a153741
commit 3ae662f4c7
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 0 deletions

View File

@ -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]));
}
}