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