Commit 2b57e3b3584 for php.net
commit 2b57e3b358423e0db5ce32caf66cddcc9e6d0f84
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Thu Aug 13 23:45:02 2026 +0700
fix: flaky cli server when parallel (#23238)
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 3ad6ced5cb4..feee2bbb568 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -16,8 +16,8 @@ function php_cli_server_start(
$php_executable = getenv('TEST_PHP_EXECUTABLE') ?: PHP_BINARY;
$error = null;
- // Create dedicated doc root to avoid index.php clashes between tests.
- $doc_root = __DIR__ . DIRECTORY_SEPARATOR . basename($_SERVER['PHP_SELF'], '.php');
+ // Create dedicated doc root to avoid index.php clashes between processes.
+ $doc_root = __DIR__ . DIRECTORY_SEPARATOR . basename($_SERVER['PHP_SELF'], '.php') . '-' . getmypid();
@mkdir($doc_root);
if ($code) {
diff --git a/sapi/cli/tests/php_cli_server_002.phpt b/sapi/cli/tests/php_cli_server_002.phpt
index d2b561b8bb6..e3204c06ee8 100644
--- a/sapi/cli/tests/php_cli_server_002.phpt
+++ b/sapi/cli/tests/php_cli_server_002.phpt
@@ -13,7 +13,7 @@
var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS));
?>
--EXPECTF--
-string(%d) "string(%d) "%sphp_cli_server_002"
+string(%d) "string(%d) "%sphp_cli_server_002-%d"
string(%d) "PHP/%s (Development Server)"
string(%d) "localhost"
string(%d) "%s"