Skip to content

Commit 8753975

Browse files
committed
Fix intermittent error in pdo_mysql___construct_options.phpt
For the love of god, don't write tests based on mt_rand!
1 parent e760d94 commit 8753975

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ MySQLPDOTest::skip();
7676
if (!is_object($db = new PDO($dsn, $user, $pass, array())))
7777
printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db);
7878

79-
do {
80-
$invalid = mt_rand(-1000, 1000);
81-
} while (isset($valid_options[$invalid]));
79+
$invalid = 999;
8280
if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
8381
printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n");
8482

ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
1515
$db = MySQLPDOTest::factory();
1616
MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
1717

18-
function find_invalid_int($valid_options) {
19-
do {
20-
$invalid = mt_rand(-10000, 10000);
21-
} while (in_array($invalid, $valid_options));
22-
return $invalid;
23-
}
24-
2518
function set_and_get($offset, $db, $attribute, $value) {
2619

2720
$value_type = gettype($value);

0 commit comments

Comments
 (0)