From: Nikita Popov Date: Fri, 6 Dec 2019 06:38:56 +0000 (+0100) Subject: Fix intermittent error in pdo_mysql___construct_options.phpt X-Git-Tag: php-7.4.7RC1~464 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8753975418e8737b433b2b8ad818d829f5edca96;p=php Fix intermittent error in pdo_mysql___construct_options.phpt For the love of god, don't write tests based on mt_rand! --- diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt index 9482a13bfa..b7a52127c5 100644 --- a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt @@ -76,9 +76,7 @@ MySQLPDOTest::skip(); if (!is_object($db = new PDO($dsn, $user, $pass, array()))) printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db); - do { - $invalid = mt_rand(-1000, 1000); - } while (isset($valid_options[$invalid])); + $invalid = 999; if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true)))) printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n"); diff --git a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt index 2eb34cd076..51310faa9e 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt @@ -15,13 +15,6 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db)) $db = MySQLPDOTest::factory(); MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db)); - function find_invalid_int($valid_options) { - do { - $invalid = mt_rand(-10000, 10000); - } while (in_array($invalid, $valid_options)); - return $invalid; - } - function set_and_get($offset, $db, $attribute, $value) { $value_type = gettype($value);