1--TEST-- 2Bug GH-9602 (stream_select does not abort upon exception or empty valid fd set) 3--EXTENSIONS-- 4mysqli 5posix 6--SKIPIF-- 7<?php 8require_once __DIR__ . '/test_setup/test_helpers.inc'; 9$link = mysqli_connect_or_skip(); 10if (mysqli_get_server_version($link) < 50012) 11 die("skip Test needs SQL function SLEEP() available as of MySQL 5.0.12"); 12 13if (!function_exists('posix_setrlimit') || !posix_setrlimit(POSIX_RLIMIT_NOFILE, 2048, -1)) 14 die('skip Failed to set POSIX_RLIMIT_NOFILE'); 15?> 16--FILE-- 17<?php 18 posix_setrlimit(POSIX_RLIMIT_NOFILE, 2048, -1); 19 20 $fds = []; 21 for ($i = 0; $i < 1023; $i++) { 22 $fds[] = @fopen(__DIR__ . "/GH-9590-tmpfile.$i", 'w'); 23 } 24 25 require_once 'connect.inc'; 26 27 function get_connection() { 28 global $host, $user, $passwd, $db, $port, $socket; 29 30 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 31 printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 32 return $link; 33 } 34 35 36 $mysqli1 = get_connection(); 37 $mysqli2 = get_connection(); 38 39 var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); 40 var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT)); 41 42 $links = $errors = $reject = array($mysqli1, $mysqli2); 43 var_dump(mysqli_poll($links, $errors, $reject, 0, 50000)); 44 45 mysqli_close($mysqli1); 46 mysqli_close($mysqli2); 47 48 print "done!"; 49?> 50--EXPECTF-- 51bool(true) 52bool(true) 53 54Warning: mysqli_poll(): You MUST recompile PHP with a larger value of FD_SETSIZE. 55It is set to 1024, but you have descriptors numbered at least as high as %d. 56 --enable-fd-setsize=%d is recommended, but you may want to set it 57to equal the maximum number of open files supported by your system, 58in order to avoid seeing this error again at a later date. in %s on line %d 59bool(false) 60done! 61--CLEAN-- 62<?php 63for ($i = 0; $i < 1023; $i++) { 64 @unlink(__DIR__ . "/GH-9590-tmpfile.$i"); 65} 66?> 67