Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fca5f71

Browse files
tests: do not use a shell in proc_open if not really needed
It is seldom that the tests are used to perform operations that require a shell. remove all implicit shell uses where appropiate.
1 parent 530e0d6 commit fca5f71

23 files changed

+58
-40
lines changed

‎ext/curl/tests/curl_setopt_ssl.phpt‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,22 @@ if ($serverCert === false
6161
$port = 14430;
6262

6363
// set up local server
64-
$cmd = "openssl s_server -key $serverKeyPath -cert $serverCertPath -accept $port -www -CAfile $clientCertPath -verify_return_error -Verify 1";
64+
$cmd = [
65+
'openssl',
66+
's_server',
67+
'-key',
68+
$serverKeyPath,
69+
'-cert',
70+
$serverCertPath,
71+
'-accept',
72+
$port,
73+
'-www',
74+
'-CAfile',
75+
$clientCertPath,
76+
'-verify_return_error',
77+
'-Verify',
78+
1
79+
];
6580
$process = proc_open($cmd, [["pipe", "r"], ["pipe", "w"], ["pipe", "w"]], $pipes);
6681

6782
if ($process === false) {

‎ext/openssl/tests/stream_server_reneg_limit.phpt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ $serverCode = sprintf($serverCode, $certFile);
7373
$clientCode = <<<'CODE'
7474
phpt_wait();
7575
76-
$cmd = 'openssl s_client -connect 127.0.0.1:64321';
76+
$cmd = [
77+
'openssl',
78+
's_client',
79+
'-connect',
80+
'127.0.0.1:64321'
81+
];
7782
$descriptorSpec = [["pipe", "r"], ["pipe", "w"], ["pipe", "w"]];
7883
$process = proc_open($cmd, $descriptorSpec, $pipes);
7984

‎ext/pcntl/tests/waiting_on_sigchild_pcntl_wait.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pcntl_signal(SIGCHLD, function($sig, $info) use (&$processes) {
2222

2323
for ($i = 0; $i <= 5; $i++) {
2424
// Sleeping ensures we get to add the process to the list before the signal is invoked.
25-
$process = proc_open('sleep 1', [], $pipes);
25+
$process = proc_open(['sleep', '1'], [], $pipes);
2626
$pid = proc_get_status($process)['pid'];
2727
$processes[$pid] = $process;
2828
}

‎ext/standard/tests/file/proc_open01.phpt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ 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_ESCAPED');
7+
$php = getenv('TEST_PHP_EXECUTABLE');
88
if ($php === false) {
99
die("no php executable defined");
1010
}
1111
$proc = proc_open(
12-
"$php -n",
12+
[$php, '-n'],
1313
array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
1414
$pipes, getcwd(), array(), array()
1515
);

‎ext/standard/tests/general_functions/bug34794.phpt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ if (!is_executable('/bin/cat')) echo 'skip cat not found';
77
--FILE--
88
<?php
99
echo "Opening process 1\n";
10-
$process1 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes1);
10+
$process1 = proc_open(['/bin/cat'], array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes1);
1111

1212
echo "Opening process 2\n";
13-
$process2 = proc_open('/bin/cat', array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes2);
13+
$process2 = proc_open(['/bin/cat'], array(0 => array('pipe', 'r'), 1 =>array('pipe', 'r')), $pipes2);
1414

1515

1616
echo "Closing process 1\n";

‎ext/standard/tests/general_functions/bug44667.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $descriptor_spec = array(
1212
1 => array('pipe', 'wb'),
1313
);
1414

15-
$proc = proc_open('cat', $descriptor_spec, $pipes);
15+
$proc = proc_open(['cat'], $descriptor_spec, $pipes);
1616

1717
fwrite($pipes[0], 'Hello', 5);
1818
fflush($pipes[0]);

‎ext/standard/tests/general_functions/gh10239_1.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
77
?>
88
--FILE--
99
<?php
10-
$p = proc_open('sleep 1', array(), $foo);
10+
$p = proc_open(['sleep', '1'], array(), $foo);
1111
do {
1212
usleep(100000);
1313
$s = proc_get_status($p);

‎ext/standard/tests/general_functions/gh10239_2.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
77
?>
88
--FILE--
99
<?php
10-
$p = proc_open('false', array(), $foo);
10+
$p = proc_open(['false'], array(), $foo);
1111
usleep(2 * 1000 * 1000);
1212
var_dump(proc_get_status($p));
1313
var_dump(proc_get_status($p));

‎ext/standard/tests/general_functions/gh12655.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ foreach ( $descriptor_spec as $fd => &$d )
1414
// don't do anything, just the fact that we used "&$d" will sink the ship!
1515
}
1616

17-
$proc = proc_open(PHP_BINARY, $descriptor_spec, $pipes);
17+
$proc = proc_open([PHP_BINARY], $descriptor_spec, $pipes);
1818
echo $proc === false ? "FAILED\n" : "SUCCEEDED\n";
1919

2020
?>

‎ext/standard/tests/general_functions/proc_open.phpt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ds = array(
1414
);
1515

1616
$cat = proc_open(
17-
"/bin/cat",
17+
['/bin/cat'],
1818
$ds,
1919
$pipes
2020
);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /