[php-src] master: [skip ci] sapi/cli: Wait for the connection in Expect 100-continue abort test

From: Date: Sat, 26 Sep 2026 19:38:35 +0000
Subject: [php-src] master: [skip ci] sapi/cli: Wait for the connection in Expect 100-continue abort test
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141591@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-09-26T20:38:21+01:00 Commit: https://github.com/php/php-src/commit/497fdf254e441fbfdd2135fa9bcfb370cbf0244d Raw diff: https://github.com/php/php-src/commit/497fdf254e441fbfdd2135fa9bcfb370cbf0244d.diff [skip ci] sapi/cli: Wait for the connection in Expect 100-continue abort test The test resets the connection as soon as it is opened, so the reset could reach the server while the connection was still in the listen backlog. The server then never saw the request and the expected error was never logged. Complete a request on a second connection first: the accept queue is FIFO, so a response on the later connection means the earlier one has been accepted, and the reset is guaranteed to hit an established connection. Close GH-23841 Changed paths: M sapi/cli/tests/php_cli_server_expect_100_continue_iua.phpt Diff: diff --git a/sapi/cli/tests/php_cli_server_expect_100_continue_iua.phpt b/sapi/cli/tests/php_cli_server_expect_100_continue_iua.phpt index c792630a9305..cf2a40a339a7 100644 --- a/sapi/cli/tests/php_cli_server_expect_100_continue_iua.phpt +++ b/sapi/cli/tests/php_cli_server_expect_100_continue_iua.phpt @@ -11,7 +11,15 @@ if (PHP_OS_FAMILY === "Windows") die("skip SO_LINGER reset behaviour differs on include "php_cli_server.inc"; $server = php_cli_server_start('echo "Hello world";', 'index.php', ['-d', 'ignore_user_abort=1']); -$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT); +$fp = php_cli_server_connect(); + +$probe = php_cli_server_connect(); +fwrite($probe, "GET / HTTP/1.1\r\nConnection: close\r\n\r\n"); +while (!feof($probe)) { + fgets($probe); +} +fclose($probe); + socket_set_option(socket_import_stream($fp), SOL_SOCKET, SO_LINGER, ['l_onoff' => 1, 'l_linger' => 0]); fwrite($fp, "POST / HTTP/1.1\r\nExpect: 100-continue\r\nContent-Length: 4\r\n\r\n"); fclose($fp);

« previous php.cvs (#141591) next »