1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Don't run proc_open_cmd.phpt in parallel with other tests

This test puts a fake cmd.exe in the CWD and removes it only after the
test has finished.  We need to avoid that other tests are running while
that fake cmd.exe is there, because they may use it instead of the
proper cmd.exe.

We also unlink the fake cmd.exe as soon as possible, regardless of the
test result.

Fixes GH-17098.
Closes GH-17090.
This commit is contained in:
Christoph M. Becker
2024-12-09 12:13:35 +01:00
parent a57a434f95
commit aafa6ea386

View File

@@ -1,5 +1,7 @@
--TEST--
Harden against cmd.exe hijacking
--CONFLICTS--
all
--SKIPIF--
<?php
if (PHP_OS_FAMILY !== "Windows") die("skip only for Windows");
@@ -18,6 +20,7 @@ if (($num = stream_select($read, $write, $except, 1000)) === false) {
fpassthru($stream);
}
}
@unlink("cmd.exe");
?>
--EXPECTF--
resource(%d) of type (process)