8000 Fix use the exec function execute exception when the name is a comman… · symfony/symfony@819ec41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 819ec41

Browse files
committed
Fix use the exec function execute exception when the name is a command option
1 parent 4328f5b commit 819ec41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Process/ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function find(string $name, string $default = null, array $extraDirs = []
6969
}
7070

7171
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
72-
if (\function_exists('exec') && ($executablePath = strtok(@exec($command.' '.escapeshellarg($name)), \PHP_EOL)) && @is_executable($executablePath)) {
72+
if (\function_exists('exec') && !str_starts_with($name,'-') &&($executablePath = strtok(@exec($command.' '.escapeshellarg($name)), \PHP_EOL)) && @is_executable($executablePath)) {
7373
return $executablePath;
7474
}
7575

0 commit comments

Comments
 (0)
0