Skip to content

Commit 7ce8791

Browse files
committed
Unblock tests under ASan on Windows
These tests execute php.exe without passing the PATH, what might be a more general issues, but at least with ASan enabled, the required DLLs could usually not be found, resulting in the tests stalling. Closes GH-17079.
1 parent c5d9c7d commit 7ce8791

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

ext/standard/tests/file/bug72035.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ $cmd = "$cgi -n -C $fl";
2121

2222
/* Need to run CGI with the env reset. */
2323
$desc = array(0 => array("pipe", "r"));
24-
$proc = proc_open($cmd, $desc, $pipes, getcwd(), array());
24+
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
25+
$proc = proc_open($cmd, $desc, $pipes, getcwd(), array('PATH' => getenv('PATH')));
2526
if (is_resource($proc)) {
2627
echo stream_get_contents($pipes[0]);
2728

ext/standard/tests/file/proc_open01.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
88
if ($php === false) {
99
die("no php executable defined");
1010
}
11+
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
1112
$proc = proc_open(
1213
"$php -n",
1314
array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
14-
$pipes, getcwd(), array(), array()
15+
$pipes, getcwd(), array('PATH' => getenv('PATH')), array()
1516
);
1617
if ($proc === false) {
1718
print "something went wrong.\n";

ext/standard/tests/general_functions/proc_open_array.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ fpassthru($pipes[1]);
4444
proc_close($proc);
4545

4646
putenv('ENV_1=ENV_1');
47-
$env = ['ENV_2' => 'ENV_2'];
47+
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
48+
$env = ['ENV_2' => 'ENV_2', 'PATH' => getenv('PATH')];
4849
$cmd = [$php, '-n', '-r', 'var_dump(getenv("ENV_1"), getenv("ENV_2"));'];
4950

5051
echo "\nEnvironment inheritance:\n";

ext/standard/tests/streams/proc_open_bug60120.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ TMPFILE
2121

2222
$command = sprintf("%s -n %s", getenv('TEST_PHP_EXECUTABLE_ESCAPED'), escapeshellarg($file));
2323

24+
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
2425
$process = proc_open(
2526
$command,
2627
[
@@ -30,7 +31,7 @@ $process = proc_open(
3031
],
3132
$pipes,
3233
getcwd(),
33-
[],
34+
['PATH' => getenv('PATH')],
3435
[
3536
'suppress_errors' => true,
3637
'bypass_shell' => false

ext/standard/tests/streams/proc_open_bug64438.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'))
1414
$stdin = str_repeat('*', 4097);
1515

1616
$options = array_merge(array('suppress_errors' => true, 'bypass_shell' => false));
17-
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
17+
/* PATH is needed to find ASan DLLs (and maybe others) on Windows */
18+
$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array('PATH' => getenv('PATH')), $options);
1819

1920
foreach ($pipes as $pipe) {
2021
stream_set_blocking($pipe, false);

0 commit comments

Comments
 (0)