diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt index 6bb2fd80bb1..cfe8f8464be 100644 --- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt @@ -121,25 +121,21 @@ require_once 'skipifconnectfailure.inc'; } $row = $tmp[0]; - $fields = mysqli_fetch_fields($res); - - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $link->errno, $link->error); - return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $link->errno, $link->error); - return false; - } + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $link->errno, $link->error); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $link->errno, $link->error); + return false; } } diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index ed1c76f3ded..2ec58913fb5 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -109,22 +109,6 @@ require_once 'skipifconnectfailure.inc'; gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); return false; } - } else if ((gettype($php_value) == 'unicode') && $binary_type) { - // Unicode is on and we are told that the MySQL column type is a binary type. - // Don't expect a unicode value from the database, you'll get binary string - if (($row['label'] != $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link)); - return false; - } - if (gettype($row['label']) == 'unicode') { - var_dump(mysqli_fetch_field_direct($res, 1), $row['label']); - printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n", - $offset + 6, $sql_type); - return false; - } } else { if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 7, diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt index 23ae16cdd2e..8639b7419b1 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt @@ -103,27 +103,25 @@ require_once 'skipifconnectfailure.inc'; printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error); return false; } - $fields = mysqli_fetch_fields($res); - if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) { - if ($regexp_comparison) { - if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { - printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, $regexp_comparison, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); + if ($regexp_comparison) { + if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) { + printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, $regexp_comparison, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); + return false; + } + } else { + if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { + printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, + gettype($php_value), $php_value, + gettype($row[1]), $row[1], + gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); return false; - } - } else { - if (($row['label'] !== $php_value) || ($row[1] != $php_value)) { - printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4, - gettype($php_value), $php_value, - gettype($row[1]), $row[1], - gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error); - return false; - } } } + return true; } diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt index 7718263bc45..0bc49bab8ab 100644 --- a/ext/mysqli/tests/mysqli_get_charset.phpt +++ b/ext/mysqli/tests/mysqli_get_charset.phpt @@ -49,12 +49,12 @@ require_once 'skipifconnectfailure.inc'; printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset); if (!isset($charset->charset) || - !in_array(gettype($charset->charset), array("string", "unicode")) || - ($character_set_connection !== $charset->charset)) + !is_string($charset->charset) || + $character_set_connection !== $charset->charset) printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset); if (!isset($charset->collation) || - !in_array(gettype($charset->collation), array("string", "unicode")) || - ($collation_connection !== $charset->collation)) + !is_string($charset->collation) || + $collation_connection !== $charset->collation) printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation); if (!isset($charset->dir) || diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index a8d509eb627..90823854d41 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -112,7 +112,6 @@ mysqli.allow_local_infile=1 // we assume the above as tested and in the following we check only those mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter); - /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter); mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter); mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter); diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt index 11d8e64e966..5a210f3d2e3 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt @@ -80,14 +80,12 @@ require_once 'skipifconnectfailure.inc'; $id = null; if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } for ($id = 1; $id < 4; $id++) { if (!mysqli_stmt_execute($stmt)) { printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } } @@ -97,37 +95,28 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } if (!mysqli_stmt_execute($stmt)) { printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } - $result = mysqli_stmt_result_metadata($stmt); - $bind_res = null; if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) { printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } $num = 0; - $fields = mysqli_fetch_fields($result); while (mysqli_stmt_fetch($stmt)) { - if (!gettype($bind_res)=="unicode") { - if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { - printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", - $offset + 10, $num, - gettype($bind_value), $bind_value, $type_hint, - gettype($bind_res), $bind_res); - mysqli_stmt_close($stmt); - return false; - } + if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { + printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", + $offset + 10, $num, + gettype($bind_value), $bind_value, $type_hint, + gettype($bind_res), $bind_res); + return false; } $num++; } @@ -135,11 +124,9 @@ require_once 'skipifconnectfailure.inc'; if ($num != 3) { printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - mysqli_stmt_close($stmt); return false; } - mysqli_stmt_close($stmt); return true; } @@ -193,26 +180,20 @@ require_once 'skipifconnectfailure.inc'; func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800); func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); - func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); - func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9237.21, 600); func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620); - func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); + func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18467.5, 640); func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); // Yes, we need the temporary variable. The PHP casting will foul us otherwise. - $tmp = strval('-99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", '-99999999.99', 680, "double"); func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); - $tmp = strval('99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", '99999999.99' , 720, "double"); func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); - $tmp = strval('-99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", '-99999999.99', 760, "string"); func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); - $tmp = strval('99999999.99'); - func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); + func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", '99999999.99', 800, "string"); func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); // don't care about date() strict TZ warnings... @@ -231,8 +212,8 @@ require_once 'skipifconnectfailure.inc'; func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020); $tmp = intval(@date('Y')); - func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); - func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); + func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "string"); // YEAR is a string with implicit display width of 4 + func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "string"); func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080); $string255 = func_mysqli_stmt_bind_make_string(255); @@ -284,7 +265,7 @@ require_once 'skipifconnectfailure.inc'; func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string'); if (mysqli_get_server_version($link) >= 50600) - func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34"); + func_mysqli_stmt_bind_result($link, $engine, "s", "TIME(6)", "13:31:34.123456", 1770); $stmt = mysqli_stmt_init($link); if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')")) diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt index d2ae94c5f94..f49c2079f72 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt @@ -37,14 +37,12 @@ mysqli $id = null; if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) { printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } for ($id = 1; $id < 4; $id++) { if (!mysqli_stmt_execute($stmt)) { printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } } @@ -54,38 +52,27 @@ mysqli if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) { printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } if (!mysqli_stmt_execute($stmt)) { printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } - $result = mysqli_stmt_result_metadata($stmt); - if (!$res = mysqli_stmt_get_result($stmt)) { printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - mysqli_stmt_close($stmt); return false; } $num = 0; - $fields = mysqli_fetch_fields($result); while ($row = mysqli_fetch_assoc($res)) { - $bind_res = &$row['label']; - if (!gettype($bind_res) == 'unicode') { - if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) { - printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", - $offset + 10, $num, - gettype($bind_value), $bind_value, $type_hint, - gettype($bind_res), $bind_res); - mysqli_free_result($res); - mysqli_stmt_close($stmt); - return false; - } + if ($row['label'] !== $bind_value && (!$type_hint || ($type_hint !== gettype($row['label'])))) { + printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n", + $offset + 10, $num, + gettype($bind_value), $bind_value, $type_hint, + gettype($row['label']), $row['label']); + return false; } $num++; } @@ -93,13 +80,9 @@ mysqli if ($num != 3) { printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num); - mysqli_free_result($res); - mysqli_stmt_close($stmt); return false; } - mysqli_free_result($res); - mysqli_stmt_close($stmt); return true; } @@ -154,28 +137,22 @@ mysqli func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820); func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840); func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860); - func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880); + func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880, "integer"); - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600); + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9237.21, 600); func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620); - func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640); + func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18467.5, 640); func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660); - // Yes, we need the temporary variable. The PHP casting will foul us otherwise. - $tmp = strval('-99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 680); func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700); - $tmp = strval('99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99 , 720); func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740); - $tmp = strval('-99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", '-99999999.99', 760, "string"); func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780); - $tmp = strval('99999999.99'); - func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string"); + func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", '99999999.99', 800, "string"); func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820); - // don't care about date() strict TZ warnings... func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840); func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860); func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880); @@ -191,8 +168,8 @@ mysqli func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020); $tmp = intval(@date('Y')); - func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer"); - func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer"); + func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "string"); // YEAR is a string with implicit display width of 4 + func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "string"); func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080); $string255 = func_mysqli_stmt_bind_make_string(255);