[php-src] Issue #9590: stream_select does not abort upon exception and empty valid fd set

From: Date: Wed, 21 Sep 2022 14:47:16 +0000
Subject: [php-src] Issue #9590: stream_select does not abort upon exception and empty valid fd set
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242450@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9590 Author: bwoebi ### Description The following code: ```php <?php $fds = []; for ($i = 0; $i < 1023; $i++) { $fds[] = fopen("/tmp/test/__0_a_evil_tmpfile.$i", 'w'); } list($a, $b) = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP); $r = [$a]; $w = $e = []; var_dump(stream_select($r, $w, $e, PHP_INT_MAX)); ``` Will result in a hang, after printing the warning, with an empty select() syscall being emitted. However, adding in an error handler throwing an exception, e.g. set_error_handler(function() { throw new \Exception; }); at the start will cause the warning not be printed and still hang indefinitely, hiding the issue very well. (Original bug report at https://github.com/amphp/amp/issues/398) ### PHP Version PHP 7.4 - master ### Operating System _No response_

« previous php.bugs (#242450) next »