[php-src] Issue #11175: Stream Socket Timeout

From: Date: Tue, 02 May 2023 08:46:27 +0000
Subject: [php-src] Issue #11175: Stream Socket Timeout
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244325@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11175 Author: Midouxx ### Description The following code: ```php <?php ``` $socket = stream_socket_server("tcp://0.0.0.0:8080", $errno, $errstr); if (!$socket) { echo "$errstr ($errno)<br />\n"; } else { while ($conn = stream_socket_accept($socket, -1)) { fwrite($conn, 'The local time is ' . date('n/j/Y g:i a') . "\n"); fclose($conn); } fclose($socket); } Resulted in this output: ``` Warning: stream_socket_accept(): Accept failed: Operation timed out in ....server.php ``` But I expected this output instead: ``` ``` The expected behaviour until php ** 8.1** is to make this function wait indefinitely to incoming connections, just as in socket_accept, by setting the timeout to -1. But it times out immediately The setting of ``default_socket_timeout`` to a negative value via init_set does not fix the problem as well. ### PHP Version PHP 8.2.5 ### Operating System _No response_

« previous php.bugs (#244325) next »