Skip to content

Commit 8cd9090

Browse files
committed
Fix GH-10489: run-tests.php does not escape path when building cmd
Multiple tests had to be changed to escape the arguments in shell commands. Some tests are skipped because they behave differently with spaces in the path versus without. One notable example of this is the hashbang test which does not work because spaces in hashbangs paths are not supported in Linux.
1 parent 18b611d commit 8cd9090

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+116
-93
lines changed

Zend/tests/bug40236.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if (extension_loaded("readline")) die("skip Test doesn't support readline");
66
?>
77
--FILE--
88
<?php
9-
$php = getenv('TEST_PHP_EXECUTABLE');
10-
$cmd = "\"$php\" -n -d memory_limit=4M -a \"".__DIR__."\"/bug40236.inc";
9+
$php = escapeshellarg(getenv('TEST_PHP_EXECUTABLE'));
10+
$cmd = "$php -n -d memory_limit=4M -a \"".__DIR__."\"/bug40236.inc";
1111
echo `$cmd`;
1212
?>
1313
--EXPECT--

Zend/tests/bug60978.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #60978 (exit code incorrect)
33
--FILE--
44
<?php
55
$php = getenv('TEST_PHP_EXECUTABLE');
6-
exec($php . ' -n -r "exit(2);"', $output, $exit_code);
6+
exec(escapeshellarg($php) . ' -n -r "exit(2);"', $output, $exit_code);
77
echo $exit_code;
88
?>
99
--EXPECT--

ext/com_dotnet/tests/bug77578.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ com_dotnet
66
<?php
77
// To actually be able to verify the crash during shutdown on Windows, we have
88
// to execute a PHP subprocess, and check its exit status.
9-
$php = PHP_BINARY;
9+
$php = escapeshellarg(PHP_BINARY);
1010
$ini = php_ini_loaded_file();
1111
$iniopt = $ini ? "-c $ini" : '';
1212
$command = "$php $iniopt -d extension=com_dotnet -d com.autoregister_typelib=1 -r \"new COM('WbemScripting.SWbemLocator');\"";

ext/mbstring/tests/gh7902.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ GH-7902 (mb_send_mail may delimit headers with LF only)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded("mbstring")) die("skip mbstring extension not available");
6+
if (str_contains(getcwd(), " ")) die("skip sendmail_path ini with spaces");
67
?>
78
--INI--
89
sendmail_path={MAIL:{PWD}/gh7902.eml}

ext/simplexml/tests/bug79971_1.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Bug #79971 (special character is breaking the path in xml function)
33
--SKIPIF--
44
<?php
55
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
6+
if (str_contains(getcwd(), ' ')) die('skip simplexml already escapes the path with spaces so this test does not work');
67
?>
78
--FILE--
89
<?php

ext/standard/tests/directory/bug74589_utf8.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ internal_encoding=utf-8
1818
$item = "bug74589_新建文件夹"; // utf-8 string
1919
$dir = __DIR__ . DIRECTORY_SEPARATOR . $item;
2020
$test_file = $dir . DIRECTORY_SEPARATOR . "test.php";
21+
$test_file_escaped = escapeshellarg($test_file);
2122

2223
mkdir($dir);
2324

@@ -27,9 +28,9 @@ file_put_contents($test_file,
2728
var_dump(__FILE__);
2829
var_dump(__DIR__ === __DIR__);");
2930

30-
$php = getenv('TEST_PHP_EXECUTABLE');
31+
$php = escapeshellarg(getenv('TEST_PHP_EXECUTABLE'));
3132

32-
echo shell_exec("$php -n $test_file");
33+
echo shell_exec("$php -n $test_file_escaped");
3334

3435
?>
3536
--EXPECTF--

ext/standard/tests/file/bug22414.phpt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ output_handler=
66
<?php
77

88
$php = getenv('TEST_PHP_EXECUTABLE');
9+
$php_escaped = escapeshellarg($php);
910
$tmpfile = tempnam(__DIR__, 'phpt');
1011
$args = ' -n ';
1112

1213
/* Regular Data Test */
13-
passthru($php . $args . ' -r " echo \"HELLO\"; "');
14+
passthru($php_escaped . $args . ' -r " echo \"HELLO\"; "');
1415

1516
echo "\n";
1617

1718
/* Binary Data Test */
18-
19+
$cmd = $php_escaped . $args . ' -r ' . escapeshellarg("readfile(@getenv('TEST_PHP_EXECUTABLE'));");
1920
if (substr(PHP_OS, 0, 3) != 'WIN') {
20-
$cmd = $php . $args . ' -r \"readfile(@getenv(\'\\\'\'TEST_PHP_EXECUTABLE\'\\\'\')); \"';
21-
$cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
21+
$cmd = $php_escaped . $args . ' -r ' . escapeshellarg('passthru("'.$cmd.'");') . ' > '.escapeshellarg($tmpfile);
2222
} else {
23-
$cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
24-
$cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
23+
$cmd = $php_escaped . $args . ' -r ' . "\"passthru('".addslashes($cmd)."');\"" . ' > '.escapeshellarg($tmpfile);
2524
}
2625
exec($cmd);
2726

ext/standard/tests/file/bug26615.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ variables_order=E
77
$out = array();
88
$status = -1;
99
if (substr(PHP_OS, 0, 3) != 'WIN') {
10-
exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
10+
exec(escapeshellarg($_ENV['TEST_PHP_EXECUTABLE']).' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
1111
} else {
12-
exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
12+
exec(escapeshellarg($_ENV['TEST_PHP_EXECUTABLE']).' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
1313
}
1414
print_r($out);
1515
?>

ext/standard/tests/file/bug26938.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #26938 (exec does not read consecutive long lines correctly)
44
<?php
55
$out = array();
66
$status = -1;
7-
$php = getenv('TEST_PHP_EXECUTABLE');
7+
$php = escapeshellarg(getenv('TEST_PHP_EXECUTABLE'));
88
if (substr(PHP_OS, 0, 3) != 'WIN') {
99
exec($php . ' -n -r \''
1010
. '$lengths = array(10,20000,10000,5,10000,3);'

ext/standard/tests/file/mkdir-002.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ var_dump(rmdir("./mkdir-002"));
2424
var_dump(mkdir(__DIR__."/mkdir-002", 0777));
2525
var_dump(mkdir(__DIR__."/mkdir-002/subdir", 0777));
2626
$dirname = __DIR__."/mkdir-002";
27-
var_dump(`ls -l $dirname`);
27+
$dirname_escaped = escapeshellarg($dirname);
28+
var_dump(`ls -l $dirname_escaped`);
2829
var_dump(rmdir(__DIR__."/mkdir-002/subdir"));
2930
var_dump(rmdir(__DIR__."/mkdir-002"));
3031

ext/standard/tests/file/popen_pclose_basic.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ echo "-- Testing popen(): reading from the pipe --\n";
1616
$dirpath = $file_path."/popen_basic";
1717
mkdir($dirpath);
1818
touch($dirpath."/popen_basic.tmp");
19-
define('CMD', "ls $dirpath");
19+
define('CMD', "ls " . escapeshellarg($dirpath));
2020
$file_handle = popen(CMD, 'r');
2121
fpassthru($file_handle);
2222
pclose($file_handle);
2323

2424
echo "-- Testing popen(): reading from a file using 'cat' command --\n";
2525
create_files($dirpath, 1, "text_with_new_line", 0755, 100, "w", "popen_basic", 1, "bytes");
2626
$filename = $dirpath."/popen_basic1.tmp";
27-
$command = "cat $filename";
27+
$filename_escaped = escapeshellarg($filename);
28+
$command = "cat $filename_escaped";
2829
$file_handle = popen($command, "r");
2930
$return_value = fpassthru($file_handle);
3031
echo "\n";

ext/standard/tests/file/proc_open01.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ proc_open() regression test 1 (proc_open() leak)
44
<?php
55
$pipes = array(1, 2, 3);
66
$orig_pipes = $pipes;
7-
$php = getenv('TEST_PHP_EXECUTABLE');
7+
$php = escapeshellarg(getenv('TEST_PHP_EXECUTABLE'));
88
if ($php === false) {
99
die("no php executable defined");
1010
}

ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CODE;
4949
$code_fn = "code.php";
5050
file_put_contents($code_fn, $code);
5151

52-
print(shell_exec(getenv('TEST_PHP_EXECUTABLE') . " -n -d default_charset=cp1251 -f code.php"));
52+
print(shell_exec(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . " -n -d default_charset=cp1251 -f code.php"));
5353

5454
chdir($old_cwd);
5555

ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CODE;
4747
$code_fn = "code.php";
4848
file_put_contents($code_fn, $code);
4949

50-
print(shell_exec(getenv('TEST_PHP_EXECUTABLE') . " -nf code.php"));
50+
print(shell_exec(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . " -nf code.php"));
5151

5252
chdir($old_cwd);
5353

ext/standard/tests/general_functions/bug69646.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SCRIPT;
2424
$script = __DIR__ . DIRECTORY_SEPARATOR . "arginfo.php";
2525
file_put_contents($script, $helper_script);
2626

27-
$cmd = PHP_BINARY . " " . $script . " " . escapeshellarg($a) . " " . escapeshellarg($b);
27+
$cmd = escapeshellarg(PHP_BINARY) . " " . escapeshellarg($script) . " " . escapeshellarg($a) . " " . escapeshellarg($b);
2828

2929
system($cmd);
3030

ext/standard/tests/general_functions/bug70018.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ Bug #70018 (exec does not strip all whitespace)
55
$output = array();
66

77
$test_fl = __DIR__ . DIRECTORY_SEPARATOR . md5(uniqid());
8+
$test_fl_escaped = escapeshellarg($test_fl);
89
file_put_contents($test_fl, '<?php echo "abc\f\n \n";');
910

10-
exec(PHP_BINARY . " -n $test_fl", $output);
11+
exec(escapeshellarg(PHP_BINARY) . " -n $test_fl_escaped", $output);
1112

1213
var_dump($output);
1314

ext/standard/tests/general_functions/proc_open-mb0.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ if (!function_exists("proc_open")) echo "skip proc_open() is not available";
77
--FILE--
88
<?php
99

10-
$php = PHP_BINARY;
10+
$php = escapeshellarg(PHP_BINARY);
1111

1212
$f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb0.php";
13+
$f_escaped = escapeshellarg($f);
1314
file_put_contents($f,'<?php var_dump($argv); ?>');
1415

1516
$ds = array(
@@ -19,7 +20,7 @@ $ds = array(
1920
);
2021

2122
$p = proc_open(
22-
"$php -n $f テストマルチバイト・パス füße карамба",
23+
"$php -n $f_escaped テストマルチバイト・パス füße карамба",
2324
$ds,
2425
$pipes,
2526
NULL,

ext/standard/tests/general_functions/proc_open-mb1.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ if (!function_exists("proc_open")) echo "skip proc_open() is not available";
77
--FILE--
88
<?php
99

10-
$php = PHP_BINARY;
10+
$php = escapeshellarg(PHP_BINARY);
1111

1212
$f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb1.php";
13+
$f_escaped = escapeshellarg($f);
1314
file_put_contents($f,'<?php var_dump($argv); ?>');
1415

1516
$ds = array(
@@ -19,7 +20,7 @@ $ds = array(
1920
);
2021

2122
$p = proc_open(
22-
"$php -n $f テストマルチバイト・パス füße карамба",
23+
"$php -n $f_escaped テストマルチバイト・パス füße карамба",
2324
$ds,
2425
$pipes
2526
);

ext/standard/tests/general_functions/proc_open_pipes1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ for ($i = 3; $i<= 30; $i++) {
77
$spec[$i] = array('pipe', 'w');
88
}
99

10-
$php = getenv("TEST_PHP_EXECUTABLE");
11-
$callee = __DIR__ . "/proc_open_pipes_sleep.inc";
10+
$php = escapeshellarg(getenv("TEST_PHP_EXECUTABLE"));
11+
$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_sleep.inc");
1212
proc_open("$php -n $callee", $spec, $pipes);
1313

1414
var_dump(count($spec));

ext/standard/tests/general_functions/proc_open_pipes2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ proc_open() with no pipes
55

66
$spec = array();
77

8-
$php = getenv("TEST_PHP_EXECUTABLE");
9-
$callee = __DIR__ . "/proc_open_pipes_sleep.inc";
8+
$php = escapeshellarg(getenv("TEST_PHP_EXECUTABLE"));
9+
$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_sleep.inc");
1010
proc_open("$php -n $callee", $spec, $pipes);
1111

1212
var_dump(count($spec));

ext/standard/tests/general_functions/proc_open_pipes3.phpt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,26 @@ for ($i = 3; $i<= 5; $i++) {
77
$spec[$i] = array('pipe', 'w');
88
}
99

10-
$php = getenv("TEST_PHP_EXECUTABLE");
10+
$php = escapeshellarg(getenv("TEST_PHP_EXECUTABLE"));
1111
$callee = __DIR__ . "/proc_open_pipes_sleep.inc";
12+
$callee_escaped = escapeshellarg($callee);
1213

1314
$spec[$i] = array('pi');
14-
proc_open("$php -n $callee", $spec, $pipes);
15+
proc_open("$php -n $callee_escaped", $spec, $pipes);
1516

1617
$spec[$i] = 1;
1718
try {
18-
proc_open("$php -n $callee", $spec, $pipes);
19+
proc_open("$php -n $callee_escaped", $spec, $pipes);
1920
} catch (ValueError $exception) {
2021
echo $exception->getMessage() . "\n";
2122
}
2223

2324
$spec[$i] = array('pipe', "test");
24-
proc_open("$php -n $callee", $spec, $pipes);
25+
proc_open("$php -n $callee_escaped", $spec, $pipes);
2526
var_dump($pipes);
2627

2728
$spec[$i] = array('file', "test", "z");
28-
proc_open("$php -n $callee", $spec, $pipes);
29+
proc_open("$php -n $callee_escaped", $spec, $pipes);
2930
var_dump($pipes);
3031

3132
echo "END\n";

ext/standard/tests/misc/bug79410.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without new
33
--FILE--
44
<?php
55
ob_start();
6-
system(getenv('TEST_PHP_EXECUTABLE') . ' -n -r "echo str_repeat(\".\", 4095);"');
6+
system(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . ' -n -r "echo str_repeat(\".\", 4095);"');
77
var_dump(strlen(ob_get_clean()));
88
?>
99
--EXPECT--

ext/standard/tests/streams/bug46024.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (getenv('SKIP_ASAN')) die("skip Test may leak");
1212
$php = realpath(getenv('TEST_PHP_EXECUTABLE'));
1313
$pipes = array();
1414
$proc = proc_open(
15-
"$php -n -i"
15+
escapeshellarg($php) . " -n -i"
1616
,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
1717
,$pipes, __DIR__, array(), array()
1818
);

ext/standard/tests/streams/bug70198.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ server
1717

1818
$srv_addr = "tcp://127.0.0.1:8964";
1919
$srv_fl = __DIR__ . "/bug70198_svr_" . md5(uniqid()) . ".php";
20+
$srv_fl_escaped = escapeshellarg($srv_fl);
2021
$srv_fl_cont = <<<SRV
2122
<?php
2223
\$socket = stream_socket_server('$srv_addr', \$errno, \$errstr);
@@ -35,7 +36,7 @@ if (!\$socket) {
3536
SRV;
3637
file_put_contents($srv_fl, $srv_fl_cont);
3738
$dummy0 = $dummy1 = array();
38-
$srv_proc = proc_open(PHP_BINARY . " -n $srv_fl", $dummy0, $dummy1);
39+
$srv_proc = proc_open(escapeshellarg(PHP_BINARY) . " -n $srv_fl_escaped", $dummy0, $dummy1);
3940

4041
$i = 0;
4142
/* wait a bit for the server startup */

ext/standard/tests/streams/bug78883.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $descriptorspec = array(
1313
//2 => array("file", "stderr.txt", "ab")
1414
);
1515
$pipes = [];
16-
$cmd = 'cmd.exe "/c START ^"^" /WAIT ' . PHP_BINARY . ' -r ^"var_dump(fgets(STDIN));"';
16+
$cmd = 'cmd.exe "/c START ^"^" /WAIT ' . escapeshellarg(PHP_BINARY) . ' -r ^"var_dump(fgets(STDIN));"';
1717
$proc = proc_open($cmd, $descriptorspec, $pipes);
1818
var_dump(is_resource($proc));
1919
$pid = proc_get_status($proc)['pid'];

ext/standard/tests/streams/proc_open_bug51800_right.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ if (strpos(PHP_OS, 'FreeBSD') !== false) {
99
--FILE--
1010
<?php
1111
$callee = __DIR__ . "/process_proc_open_bug51800_right.php";
12-
$php = PHP_BINARY;
13-
$cmd = "$php -n $callee";
12+
$php = escapeshellarg(PHP_BINARY);
13+
$cmd = "$php -n " . escapeshellarg($callee);
1414

1515
$status;
1616
$stdout = "";

ext/standard/tests/streams/proc_open_bug51800_right2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Bug #51800 proc_open on Windows hangs forever, the right way to do it with more
33
--FILE--
44
<?php
55
$callee = __DIR__ . "/process_proc_open_bug51800_right2.php";
6-
$php = PHP_BINARY;
7-
$cmd = "$php -n $callee";
6+
$php = escapeshellarg(PHP_BINARY);
7+
$cmd = "$php -n " . escapeshellarg($callee);
88

99
$status;
1010
$stdout = "";

ext/standard/tests/streams/proc_open_bug60120.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if (\$input) {
1919
TMPFILE
2020
);
2121

22-
$command = sprintf("%s -n %s", PHP_BINARY, $file);
22+
$command = sprintf("%s -n %s", escapeshellarg(PHP_BINARY), escapeshellarg($file));
2323

2424
$process = proc_open(
2525
$command,

ext/standard/tests/streams/proc_open_bug64438.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ Bug #64438 proc_open hangs with stdin/out with 4097+ bytes
66
error_reporting(E_ALL);
77

88
if (substr(PHP_OS, 0, 3) == 'WIN') {
9-
$cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
9+
$cmd = escapeshellarg(PHP_BINARY) . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
1010
} else {
11-
$cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
11+
$cmd = escapeshellarg(PHP_BINARY) . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
1212
}
1313
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
1414
$stdin = str_repeat('*', 4097);

ext/standard/tests/streams/proc_open_bug69900.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ file_put_contents($fl, $test_content);
2323
$descriptorspec = array(0 => array("pipe", "r"),1 => array("pipe", "w"));
2424
$pipes = array();
2525

26-
$process = proc_open(PHP_BINARY.' -n -f ' . $fl, $descriptorspec, $pipes, NULL, NULL, array("blocking_pipes" => true));
26+
$process = proc_open(escapeshellarg(PHP_BINARY).' -n -f ' . escapeshellarg($fl), $descriptorspec, $pipes, NULL, NULL, array("blocking_pipes" => true));
2727

2828
$moreThanLimit = 0;
2929
for($i = 0; $i < 10; $i++){

0 commit comments

Comments
 (0)