-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony\Process 3.3.4 seems to convert an empty string argument to a quote ("
) under some circumstances:
- The empty string argument is in the middle of some other arguments.
- It is on Windows and "enhanced Windows mode" is enabled (which is the default).
exec
works correctly. Here is a repro:
<?php
require __DIR__ . '/vendor/autoload.php';
function runUsingSymf($command) {
$process = new \Symfony\Component\Process\Process($command);
$process->run();
echo $process->getOutput();
}
function runUsingExec($command) {
exec($command, $output);
echo join($output, "\n");
}
// print-args.php does `var_export($argv)`
runUsingExec('php print-args.php ""'); // $argv[1] == ''
runUsingSymf('php print-args.php ""'); // $argv[1] == ''
runUsingExec('php print-args.php "" "2"'); // $argv[1] == ''
runUsingSymf('php print-args.php "" "2"'); // $argv[1] == ''
runUsingExec('php print-args.php "1" ""'); // $argv[2] == ''
runUsingSymf('php print-args.php "1" ""'); // $argv[2] == ''
runUsingExec('php print-args.php "1" "" "3"'); // $argv[2] == ''
runUsingSymf('php print-args.php "1" "" "3"'); // $argv[2] == '"' <-- !!