1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00

Making test a bit more portable

This commit is contained in:
Ulf Wendel
2009-10-20 17:54:57 +00:00
parent 03c3c1edb3
commit 8df115c25e

View File

@@ -45,23 +45,27 @@ require_once('skipifconnectfailure.inc');
printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
$stmt->prepare("SELECT * FROM test");
mt_srand(microtime(true));
/* mysqlnd detects invalid attributes, libmysql does not AFAIK */
$invalid_ret = ($IS_MYSQLND) ? false : true;
for ($i = -100; $i < 1000; $i++) {
if (in_array($i, $valid_attr))
continue;
$invalid_attr = $i;
if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
printf("[006a] Expecting boolean/%s for attribute %d, got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
}
}
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 2; $i++) {
do {
$invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
} while (in_array($invalid_attr, $valid_attr));
if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
/* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */
printf("[006b] Expecting boolean/true for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
printf("[006b] Expecting boolean/%s for attribute %d, got %s/%s\n", $invalid_ret, $invalid_attr, gettype($tmp), $tmp);
}
}
$stmt->close();