Skip to content

Commit c4e6c02

Browse files
Use ProcessUtils::escapeArgument() instead of escapeshellarg()
1 parent 10990ac commit c4e6c02

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
},
1616
"require-dev": {
1717
"composer/composer": "^1.0.2",
18-
"symfony/phpunit-bridge": "^3.4.19|^4.1.8"
18+
"symfony/phpunit-bridge": "^3.4.19|^4.1.8",
19+
"symfony/process": "^2.8"
1920
},
2021
"autoload": {
2122
"psr-4": {

src/ScriptExecutor.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Output\OutputInterface;
2020
use Symfony\Component\Console\Output\StreamOutput;
2121
use Symfony\Component\Process\PhpExecutableFinder;
22+
use Symfony\Component\Process\ProcessUtils;
2223

2324
/**
2425
* @author Fabien Potencier <[email protected]>
@@ -99,7 +100,7 @@ private function expandSymfonyCmd(string $cmd)
99100
return null;
100101
}
101102

102-
$console = escapeshellarg($this->options->get('bin-dir').'/console');
103+
$console = ProcessUtils::escapeArgument($this->options->get('bin-dir').'/console');
103104
if ($this->io->isDecorated()) {
104105
$console .= ' --ansi';
105106
}
@@ -127,8 +128,8 @@ private function expandPhpScript(string $cmd): string
127128
$arguments[] = '--php-ini='.$ini;
128129
}
129130

130-
$phpArgs = implode(' ', array_map('escapeshellarg', $arguments));
131+
$phpArgs = implode(' ', array_map([ProcessUtils::class, 'escapeArgument'], $arguments));
131132

132-
return escapeshellarg($php).($phpArgs ? ' '.$phpArgs : '').' '.$cmd;
133+
return ProcessUtils::escapeArgument($php).($phpArgs ? ' '.$phpArgs : '').' '.$cmd;
133134
}
134135
}

0 commit comments

Comments
 (0)