com php-src: Fix intermittent error in pdo_mysql___cons truct_options.phpt: ext/pdo_mysql/tests/pdo_mysql ___construct_options.phpt
ext/pdo_mysql/tests/pdo _mysql_get_attribute.phpt

From: Date: Fri, 06 Dec 2019 06:39:54 +0000
Subject: com php-src: Fix intermittent error in pdo_mysql___cons truct_options.phpt: ext/pdo_mysql/tests/pdo_mysql ___construct_options.phpt
ext/pdo_mysql/tests/pdo _mysql_get_attribute.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-109406@lists.php.net to get a copy of this message
Commit: 8753975418e8737b433b2b8ad818d829f5edca96 Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 6 Dec 2019 07:38:56 +0100 Parents: e760d94f4bb4d0802e89af0927cecfb479cba024 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8753975418e8737b433b2b8ad818d829f5edca96 Log: Fix intermittent error in pdo_mysql___construct_options.phpt For the love of god, don't write tests based on mt_rand! Changed paths: M ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt M ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt Diff: diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt index 9482a13bfac..b7a52127c52 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 2eb34cd0762..51310faa9e2 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);

« previous php.cvs (#109406) next »