]> granicus.if.org Git - php/commitdiff
Don't use random mode in mysqli_query test
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 18 Mar 2019 15:55:25 +0000 (16:55 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 18 Mar 2019 15:58:49 +0000 (16:58 +0100)
MYSQLI_ASYNC is also valid here, at least with mysqlnd. Rather than
using a random mode that is prone to failing once in a blue moon,
use a fixed invalid value.

ext/mysqli/tests/mysqli_query.phpt

index bfa703bb010e8509aeab10965f6276e31630d078..08145cddcf2e678de757e4a178ed0e5508f90fb0 100644 (file)
@@ -94,12 +94,7 @@ require_once('skipifconnectfailure.inc');
                printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
        mysqli_free_result($res);
 
-       $valid = array(MYSQLI_USE_RESULT, MYSQLI_STORE_RESULT);
-       do {
-               $mode = mt_rand(-1000, 1000);
-       } while (in_array($mode, $valid));
-
-       if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", $mode)))
+       if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234)))
                printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n",
                        gettype($res), (is_object($res)) ? 'object' : $res,
                        mysqli_errno($link), mysqli_error($link));