diff --git a/ext/mysqli/tests/065.phpt b/ext/mysqli/tests/065.phpt index 0a6ca356a205..3e06fafc568c 100644 --- a/ext/mysqli/tests/065.phpt +++ b/ext/mysqli/tests/065.phpt @@ -16,8 +16,6 @@ require_once 'skipifconnectfailure.inc'; printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql)); $esc_str = chr(0xbf) . chr(0x5c); - $len = $charset = array(); - $tmp = null; if ($mysql->set_charset("latin1")) { /* 5C should be escaped */ diff --git a/ext/mysqli/tests/071.phpt b/ext/mysqli/tests/071.phpt index c5b569a664b0..8fb150feca26 100644 --- a/ext/mysqli/tests/071.phpt +++ b/ext/mysqli/tests/071.phpt @@ -11,7 +11,6 @@ require_once 'skipifconnectfailure.inc'; require_once 'connect.inc'; $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket); - $version = $mysql->server_version; var_dump($mysql->query('DO 1')); diff --git a/ext/mysqli/tests/bug45289.phpt b/ext/mysqli/tests/bug45289.phpt index 87256659f74c..d1591bd9b403 100644 --- a/ext/mysqli/tests/bug45289.phpt +++ b/ext/mysqli/tests/bug45289.phpt @@ -24,7 +24,7 @@ require_once 'skipifconnectfailure.inc'; if (!$stmt->bind_param('i', $id) || !$stmt->execute()) printf("[003] [%d] %s\n", $stmt->errno, $stmt->error); - if ($res = $link->store_result()) { + if ($link->store_result()) { printf("[004] Can store result!\n"); } else { printf("[004] [%d] %s\n", $link->errno, $link->error); diff --git a/ext/mysqli/tests/bug55283.phpt b/ext/mysqli/tests/bug55283.phpt index 4517e26cc303..f5473c7c4959 100644 --- a/ext/mysqli/tests/bug55283.phpt +++ b/ext/mysqli/tests/bug55283.phpt @@ -43,8 +43,6 @@ $link->close(); --FILE-- getMessage() . \PHP_EOL; } -$test2 = array(); $test2 = array(); try { $test1 = mysqli_poll($test2, $test3, $tablica, 0); diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt index 521c17e8fb99..d63f04e63cfd 100644 --- a/ext/mysqli/tests/bug66124.phpt +++ b/ext/mysqli/tests/bug66124.phpt @@ -16,7 +16,6 @@ $table_create = "CREATE TABLE `test` ( $table_insert = "INSERT INTO `test` SET `id`=?"; $table_select = "SELECT * FROM `test`"; -$table_delete = "DELETE FROM `test`"; $id = '1311200011005001566'; diff --git a/ext/mysqli/tests/bug72489.phpt b/ext/mysqli/tests/bug72489.phpt index e1ed342d4440..0c10bcd19cc4 100644 --- a/ext/mysqli/tests/bug72489.phpt +++ b/ext/mysqli/tests/bug72489.phpt @@ -45,8 +45,6 @@ while ($stmt->fetch()) { echo "Finished 1\n"; -$newArray = array(); - echo "Finished 2\n"; ?> diff --git a/ext/mysqli/tests/bug76386.phpt b/ext/mysqli/tests/bug76386.phpt index 8c4a7a7710b9..5ff4bb403100 100644 --- a/ext/mysqli/tests/bug76386.phpt +++ b/ext/mysqli/tests/bug76386.phpt @@ -67,7 +67,7 @@ $link->query('INSERT INTO t_test VALUES ();'); $stmt = $link->prepare('SELECT * FROM t_test;'); if ($stmt) { $stmt->execute(); - $tid = $t = $t2 = $t3 = $t4 = null; + $tid = $t = $t2 = $t4 = null; $stmt->bind_result($tid, $t, $t2, $t4, $t6); while ($stmt->fetch()) { var_dump($t, $t2, $t4, $t6); diff --git a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt index a7383ec48dc1..69fc427001fd 100644 --- a/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt +++ b/ext/mysqli/tests/fetch/mysqli_fetch_all_data_types_variation.phpt @@ -44,8 +44,6 @@ function func_mysqli_fetch_all( $tmp = mysqli_fetch_all($result, MYSQLI_BOTH); $row = $tmp[0]; - $fields = mysqli_fetch_fields($result); - 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, diff --git a/ext/mysqli/tests/gh14255.phpt b/ext/mysqli/tests/gh14255.phpt index 375eda0c5b52..bdf63e36dfb2 100644 --- a/ext/mysqli/tests/gh14255.phpt +++ b/ext/mysqli/tests/gh14255.phpt @@ -16,13 +16,13 @@ mysqli_report(MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR); $mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); $ca = $mysqli->query('SELECT 1 '); -$c = $ca->fetch_assoc(); +$ca->fetch_assoc(); try { $mysqli->query('SELECT non_existent_column'); } catch (Exception $e) { echo "Caught exception"."\n"; } -$c = $ca->fetch_assoc(); +$ca->fetch_assoc(); print "done!"; ?> diff --git a/ext/mysqli/tests/gh9841.phpt b/ext/mysqli/tests/gh9841.phpt index 28d720aa6e90..1e8683379e58 100644 --- a/ext/mysqli/tests/gh9841.phpt +++ b/ext/mysqli/tests/gh9841.phpt @@ -33,7 +33,7 @@ $mysqli->real_query("SELECT ( UNION ALL SELECT 2 ) FROM dual"); -$result = new mysqli_result($mysqli); +new mysqli_result($mysqli); // now make sure the errors are thrown when not using silent mode mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); @@ -65,7 +65,7 @@ $mysqli->real_query("SELECT ( SELECT 2 ) FROM dual"); try { - $result = new mysqli_result($mysqli); + new mysqli_result($mysqli); } catch (mysqli_sql_exception $e) { echo $e->getMessage()."\n"; } diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt index 2547720b3146..3a56884d148b 100644 --- a/ext/mysqli/tests/mysqli_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows.phpt @@ -78,8 +78,7 @@ mysqli if (1 !== ($tmp = mysqli_affected_rows($link))) printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); - $charsets = array('utf8'); - foreach ($charsets as $k => $charset) { + foreach (['utf8'] as $charset) { if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset)))) continue; mysqli_free_result($res); diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt index 7a7d7e36fba4..5dbd9dbc4954 100644 --- a/ext/mysqli/tests/mysqli_begin_transaction.phpt +++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt @@ -31,7 +31,7 @@ if (!have_innodb($link)) /* overrule autocommit */ if (true !== ($tmp = mysqli_begin_transaction($link))) - printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + printf("[011] Got %s - [%d] %s\n", $tmp, mysqli_errno($link), mysqli_error($link)); if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -72,7 +72,7 @@ if (!have_innodb($link)) } else if (!mysqli_commit($link)) { printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } else { - $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2"); + mysqli_query($link, "SELECT id FROM test WHERE id = 2"); } } diff --git a/ext/mysqli/tests/mysqli_change_user_new.phpt b/ext/mysqli/tests/mysqli_change_user_new.phpt index d6a9a3bd137c..e52a91e984de 100644 --- a/ext/mysqli/tests/mysqli_change_user_new.phpt +++ b/ext/mysqli/tests/mysqli_change_user_new.phpt @@ -20,9 +20,6 @@ if (mysqli_get_server_version($link) >= 10_00_00) = 50600 && mysqli_get_server_version($link = 50600) change_user($user . '_unknown_really', $passwd . 'non_empty', $db))) diff --git a/ext/mysqli/tests/mysqli_change_user_rollback.phpt b/ext/mysqli/tests/mysqli_change_user_rollback.phpt index bcef28cd1d51..2185a3083d6f 100644 --- a/ext/mysqli/tests/mysqli_change_user_rollback.phpt +++ b/ext/mysqli/tests/mysqli_change_user_rollback.phpt @@ -30,7 +30,7 @@ if (!have_innodb($link)) $num = $row['_num']; assert($num > 0); - if (!$res = mysqli_query($link, 'DELETE FROM test')) + if (false === mysqli_query($link, 'DELETE FROM test')) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt index 46ccbf61a9da..0c0b012d8702 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt @@ -15,7 +15,7 @@ require_once 'skipifconnectfailure.inc'; printf("\nClass variables:\n"); $variables = array_keys(get_class_vars(get_class($mysqli))); sort($variables); - foreach ($variables as $k => $var) { + foreach ($variables as $var) { try { printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); } catch (Error $exception) { @@ -25,7 +25,7 @@ require_once 'skipifconnectfailure.inc'; printf("\nObject variables:\n"); $variables = array_keys(get_object_vars($mysqli)); - foreach ($variables as $k => $var) { + foreach ($variables as $var) { try { printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); } catch (Error $exception) { diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt index 4e23de5cab54..5b79f7a197d9 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt @@ -69,12 +69,12 @@ require_once 'skipifconnectfailure.inc'; printf("\nClass variables:\n"); $variables = array_keys(get_class_vars(get_class($mysqli_result))); sort($variables); - foreach ($variables as $k => $var) + foreach ($variables as $var) printf("%s\n", $var); printf("\nObject variables:\n"); $variables = array_keys(get_object_vars($mysqli_result)); - foreach ($variables as $k => $var) + foreach ($variables as $var) printf("%s\n", $var); printf("\nMagic, magic properties:\n"); @@ -121,9 +121,9 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_query($link, "SELECT id FROM test ORDER BY id")) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $res = new mysqli_result($link); - $res = new mysqli_result($link, MYSQLI_STORE_RESULT); - $res = new mysqli_result($link, MYSQLI_USE_RESULT); + new mysqli_result($link); + new mysqli_result($link, MYSQLI_STORE_RESULT); + new mysqli_result($link, MYSQLI_USE_RESULT); $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); do { @@ -132,7 +132,7 @@ require_once 'skipifconnectfailure.inc'; if ($TEST_EXPERIMENTAL) { ob_start(); - $res = new mysqli_result($link, $mode); + new mysqli_result($link, $mode); $content = ob_get_contents(); ob_end_clean(); if (!stristr($content, 'Invalid value for resultmode')) diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt index 09d08de7d295..cc7e36727639 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt @@ -68,12 +68,12 @@ mysqli printf("\nClass variables:\n"); $variables = array_keys(get_class_vars(get_class($stmt))); sort($variables); - foreach ($variables as $k => $var) + foreach ($variables as $var) printf("%s\n", $var); printf("\nObject variables:\n"); $variables = array_keys(get_object_vars($stmt)); - foreach ($variables as $k => $var) + foreach ($variables as $var) printf("%s\n", $var); printf("\nMagic, magic properties:\n"); diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt index cf276d6886f6..ad903c9e1e5d 100644 --- a/ext/mysqli/tests/mysqli_connect.phpt +++ b/ext/mysqli/tests/mysqli_connect.phpt @@ -10,15 +10,13 @@ require_once 'skipifconnectfailure.inc'; $consts) { +foreach ($constants as $consts) { foreach ($consts as $name => $value) { if (stristr($name, 'mysqli')) { $name = strtoupper($name); diff --git a/ext/mysqli/tests/mysqli_debug_control_string.phpt b/ext/mysqli/tests/mysqli_debug_control_string.phpt index b745ed2ebce8..a589155c2a98 100644 --- a/ext/mysqli/tests/mysqli_debug_control_string.phpt +++ b/ext/mysqli/tests/mysqli_debug_control_string.phpt @@ -31,7 +31,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) return false; } - if (!$res = mysqli_query($link, 'SELECT * FROM test')) { + if (false === mysqli_query($link, 'SELECT * FROM test')) { printf("[%03d][control string '%s'] [%d] %s.\n", $offset + 2, $control_string, diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt index e46f4aed1984..b6876e31f1a8 100644 --- a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt +++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt @@ -40,7 +40,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) mysqli_error($link)); return false; } - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) ; mysqli_free_result($res); @@ -97,7 +97,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) // -t,[N] - maximum nesting level $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70); $lines = explode("\n", $trace); - foreach ($lines as $k => $line) { + foreach ($lines as $line) { $line = trim($line); if (!preg_match("@^(\d+):+@ismU", $line, $matches)) { printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80)); @@ -113,7 +113,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) // omitting t $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80); $lines = explode("\n", $trace); - foreach ($lines as $k => $line) { + foreach ($lines as $line) { $line = trim($line); if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) { printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n", @@ -124,7 +124,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90)); $functions_all_funcs = array(); - foreach ($lines_all_funcs as $k => $line) { + foreach ($lines_all_funcs as $line) { $line = trim($line); if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { $functions_all_funcs[$matches[1]] = $matches[1]; @@ -133,7 +133,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100)); $functions_trace = array(); - foreach ($lines_trace as $k => $line) { + foreach ($lines_trace as $line) { $line = trim($line); if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { $functions_trace[$matches[1]] = $matches[1]; @@ -169,7 +169,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110)); $functions_trace = array(); - foreach ($lines_trace as $k => $line) { + foreach ($lines_trace as $line) { $line = trim($line); if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { $functions_trace[$matches[1]] = $matches[1]; diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt index ccee53b02cf9..5327042127c3 100644 --- a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt +++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt @@ -39,7 +39,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) mysqli_error($link)); return false; } - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) ; mysqli_free_result($res); @@ -73,7 +73,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) $lines_trace = explode("\n", $trace); $functions_trace = array(); - foreach ($lines_trace as $k => $line) { + foreach ($lines_trace as $line) { $line = trim($line); if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { $functions_trace[$matches[1]] = $matches[1]; @@ -81,7 +81,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) } $found = 0; - foreach ($memory_funcs as $k => $name) + foreach ($memory_funcs as $name) if (isset($functions_trace[$name])) $found++; @@ -97,7 +97,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) $lines_trace = explode("\n", $trace); $functions_trace = array(); - foreach ($lines_trace as $k => $line) { + foreach ($lines_trace as $line) { $line = trim($line); if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) { $functions_trace[$matches[1]] = $matches[1]; @@ -105,7 +105,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED) } $found = 0; - foreach ($memory_funcs as $k => $name) + foreach ($memory_funcs as $name) if (isset($functions_trace[$name])) $found++; diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt index 40c53827a752..fba8032823f5 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt @@ -10,9 +10,6 @@ require_once 'skipifconnectfailure.inc'; errno)) printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_error_oo.phpt b/ext/mysqli/tests/mysqli_error_oo.phpt index 2e8473bb53ed..4f1a971043f9 100644 --- a/ext/mysqli/tests/mysqli_error_oo.phpt +++ b/ext/mysqli/tests/mysqli_error_oo.phpt @@ -10,9 +10,6 @@ require_once 'skipifconnectfailure.inc'; error)) printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_execute_query.phpt b/ext/mysqli/tests/mysqli_execute_query.phpt index dafb37116c2f..5730d827a406 100644 --- a/ext/mysqli/tests/mysqli_execute_query.phpt +++ b/ext/mysqli/tests/mysqli_execute_query.phpt @@ -36,7 +36,7 @@ if (!($tmp = $link->execute_query("SELECT ? AS a, ? AS b, ? AS c", [42, "foo", n assert($tmp->fetch_assoc() === ['a' => '42', 'b' => 'foo', 'c' => null]); // prepare error -if (!($tmp = $link->execute_query("some random gibberish", [1, "foo"]))) { +if (false === $link->execute_query("some random gibberish", [1, "foo"])) { printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } diff --git a/ext/mysqli/tests/mysqli_explain_metadata.phpt b/ext/mysqli/tests/mysqli_explain_metadata.phpt index a5ddf5462a51..36067365ff67 100644 --- a/ext/mysqli/tests/mysqli_explain_metadata.phpt +++ b/ext/mysqli/tests/mysqli_explain_metadata.phpt @@ -26,7 +26,7 @@ require_once 'skipifconnectfailure.inc'; $field_names[$name] = gettype($value); } - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) $num_rows++; if (($tmp = mysqli_num_rows($res)) !== $num_rows) { @@ -43,12 +43,12 @@ require_once 'skipifconnectfailure.inc'; $num_fields, gettype($tmp), $tmp); } - foreach ($fields as $k => $field) { + foreach ($fields as $field) { $field->max_length = 0;// change it or we will get diff error if (isset($field_names[$field->name])) { unset($field_names[$field->name]); } else { - printf("[006] Unexpected field '%s', dumping info\n"); + printf("[006] Unexpected field '%s', dumping info\n", $field->name); var_dump($field); } } diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt index cfe8f8464be2..8cd3984d7037 100644 --- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt @@ -86,14 +86,14 @@ require_once 'skipifconnectfailure.inc'; return false; } - if (!$link->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + if (!$link->query(sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { // don't bail, engine might not support the datatype return false; } if (is_null($php_value)) { if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error); + printf("[%04d] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql); return false; } } else { @@ -104,7 +104,7 @@ require_once 'skipifconnectfailure.inc'; } } else { if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error); + printf("[%04di] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql); return false; } } diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index 2ec58913fb55..6b3fe79a582b 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -31,7 +31,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_free_result($res); if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) { - printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link)); + printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } print "[011]\n"; var_dump(mysqli_fetch_array($res, MYSQLI_BOTH)); @@ -39,7 +39,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_free_result($res); if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) { printf("[012] Cannot run query, [%d] %s\n", - mysqli_errno($link), $mysqli_error($link)); + mysqli_errno($link), mysqli_error($link)); exit(1); } @@ -61,7 +61,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_free_result($res); - function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) { + function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) { printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt index 4650475e7333..cb11d2793035 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt @@ -12,7 +12,6 @@ require_once 'skipifconnectfailure.inc'; require 'table.inc'; // do as much as we can do in 5 seconds - $start = microtime(true); for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) { if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')", $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) { @@ -52,7 +51,7 @@ require_once 'skipifconnectfailure.inc'; } if ($row[0] !== $row['id']) { printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n", - $row[0], $row[id], mysqli_errno($link), mysqli_error($link)); + $row[0], $row['id'], mysqli_errno($link), mysqli_error($link)); break; } diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt index 8639b7419b12..225ac6711bd2 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt @@ -70,14 +70,14 @@ require_once 'skipifconnectfailure.inc'; return false; } - if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { + if (!$mysqli->query(sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) { // don't bail, engine might not support the datatype return false; } if (is_null($php_value)) { if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) { - printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); + printf("[%04d] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql); return false; } } else { @@ -88,7 +88,7 @@ require_once 'skipifconnectfailure.inc'; } } else { if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) { - printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error); + printf("[%04di] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql); return false; } } diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt index 76b6e6fb1bc3..9f3197b903c4 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt @@ -39,7 +39,6 @@ if (mysqli_get_server_version($link) < 50003) $max_value = 1; else $max_value = pow(2, $bits) - 1; - $tests = 0; if (!mysqli_query($link, "DROP TABLE IF EXISTS test") || !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine))) printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt index 418a22a223e2..a5da83a9039b 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt @@ -39,7 +39,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_free_result($res); /* Now do it with unbuffered queries */ - if (!$res = mysqli_real_query($link, "SELECT 1, 2")) { + if (false === mysqli_real_query($link, "SELECT 1, 2")) { printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (!$res = mysqli_use_result($link)) { @@ -49,7 +49,7 @@ require_once 'skipifconnectfailure.inc'; var_dump(mysqli_fetch_assoc($res)); mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) { + if (false === mysqli_real_query($link, "SELECT 1 AS a, 2")) { printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (!$res = mysqli_use_result($link)) { @@ -59,7 +59,7 @@ require_once 'skipifconnectfailure.inc'; var_dump(mysqli_fetch_assoc($res)); mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { + if (false === mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) { printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (!$res = mysqli_use_result($link)) { @@ -69,7 +69,7 @@ require_once 'skipifconnectfailure.inc'; var_dump(mysqli_fetch_assoc($res)); mysqli_free_result($res); - if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) { + if (false === mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) { printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (!$res = mysqli_use_result($link)) { diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt index 1d7e38d6c10e..8ab3443dde14 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt @@ -42,7 +42,7 @@ mysqli } /* some cyrillic (utf8) comes here */ - if (!$res = mysqli_query($link, "SET NAMES UTF8")) { + if (false === mysqli_query($link, "SET NAMES UTF8")) { printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } @@ -53,16 +53,16 @@ mysqli var_dump(mysqli_fetch_assoc($res)); mysqli_free_result($res); - if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, фамилия varchar(20) character set utf8)")) { + if (false === mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, фамилия varchar(20) character set utf8)")) { printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Андрей', 'Христов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { + if (false === mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Андрей', 'Христов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) { printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { + if (false === mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) { printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) { + if (false === mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилия) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) { printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } @@ -75,7 +75,7 @@ mysqli } mysqli_free_result($res); - if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) { + if (false === mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) { printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt index 53eb3e691694..935defa484d2 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt @@ -187,7 +187,7 @@ mysqli_close($link); $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)'); $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY'); $create = 'CREATE TABLE test(id INT, '; - foreach ($column_def as $k => $v) { + foreach ($column_def as $v) { $create .= sprintf('%s, ', $v); } $create = sprintf('%s)', substr($create, 0, -2)); @@ -198,7 +198,7 @@ mysqli_close($link); mysqli_errno($link), mysqli_error($link)); } // id column - skip it - $field = mysqli_fetch_field($res); + mysqli_fetch_field($res); while ($field = mysqli_fetch_field($res)) { if (!isset($expected_flags[$field->name])) { printf("[010] Found unexpected field '%s'\n", $field->name); diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt index 8a31ae25af3e..39d7cb861d29 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt @@ -9,13 +9,12 @@ require_once 'skipifconnectfailure.inc'; --FILE-- lengths); - while ($row = $res->fetch_assoc()) + while ($res->fetch_assoc()) var_dump($res->lengths); var_dump($res->lengths); diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt index e6ab9245152f..28e945db52f6 100644 --- a/ext/mysqli/tests/mysqli_fetch_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object.phpt @@ -122,7 +122,7 @@ require_once 'skipifconnectfailure.inc'; var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2)); This does not fail. */ - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b')); + mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b')); mysqli_free_result($res); try { diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt index 0bc49bab8abc..14f655f8b0b2 100644 --- a/ext/mysqli/tests/mysqli_get_charset.phpt +++ b/ext/mysqli/tests/mysqli_get_charset.phpt @@ -24,13 +24,9 @@ require_once 'skipifconnectfailure.inc'; if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection))) printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_fetch_assoc($res); - if (empty($tmp)) + if (!mysqli_fetch_assoc($res)) printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n"); - $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : ''; - $comment = (isset($tmp['Description'])) ? $tmp['Description'] : ''; - if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection))) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); $tmp = mysqli_fetch_assoc($res); diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index 90823854d41f..17900c5ad609 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -85,7 +85,7 @@ mysqli.allow_local_infile=1 var_dump($info); - if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { + if (false === my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); exit(1); @@ -243,7 +243,7 @@ mysqli.allow_local_infile=1 mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter); mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter); - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) ; mysqli_free_result($res); @@ -270,7 +270,7 @@ mysqli.allow_local_infile=1 ++$test_counter, mysqli_errno($link), mysqli_error($link)); for ($i = 0; $i < $num_rows - 1; $i++) - $row = mysqli_fetch_assoc($res); + mysqli_fetch_assoc($res); $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1); $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1); @@ -551,7 +551,7 @@ mysqli.allow_local_infile=1 mysqli_errno($link), mysqli_error($link)); $rows = 0; - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) $rows++; if (0 == $rows) @@ -617,7 +617,6 @@ mysqli.allow_local_infile=1 ++$test_counter, gettype($new_info), $new_info); mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX'); } - $info = $new_info; // RENAME TABLE if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test")) @@ -640,7 +639,6 @@ mysqli.allow_local_infile=1 mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE'); } - $info = $new_info; if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test")) printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter, @@ -675,7 +673,6 @@ mysqli.allow_local_infile=1 printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", ++$test_counter, gettype($new_info), $new_info); mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); - $info = $new_info; if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_")) printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter, @@ -693,7 +690,6 @@ mysqli.allow_local_infile=1 printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", ++$test_counter, gettype($new_info), $new_info); mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE'); - $info = $new_info; } // CREATE SERVER, ALTER SERVER, DROP SERVER @@ -812,7 +808,7 @@ mysqli.allow_local_infile=1 mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE'); $info = $new_info; - if (!$res = mysqli_query($link, "TRUNCATE TABLE test")) + if (false === mysqli_query($link, "TRUNCATE TABLE test")) printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); @@ -854,7 +850,7 @@ mysqli.allow_local_infile=1 printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + if (false === mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); @@ -862,7 +858,7 @@ mysqli.allow_local_infile=1 printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) ; mysqli_free_result($res); if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) @@ -871,7 +867,7 @@ mysqli.allow_local_infile=1 mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()'); $info = $new_info; - if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) + if (false === mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id")) printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); @@ -879,7 +875,7 @@ mysqli.allow_local_infile=1 printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter, mysqli_errno($link), mysqli_error($link)); - while ($row = mysqli_fetch_assoc($res)) + while (mysqli_fetch_assoc($res)) ; mysqli_free_result($res); if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) diff --git a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt index aaf409885913..a302e0bbf999 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt @@ -29,7 +29,7 @@ require_once 'skipifconnectfailure.inc'; /* fetch all rows but the last one */ for ($i = 0; $i < $num_rows - 1; $i++) - $row = mysqli_fetch_assoc($res); + mysqli_fetch_assoc($res); /* enforce implicit cleaning of the wire and skipping the last row */ mysqli_free_result($res); diff --git a/ext/mysqli/tests/mysqli_get_warnings.phpt b/ext/mysqli/tests/mysqli_get_warnings.phpt index 08831200648d..55db12d966a9 100644 --- a/ext/mysqli/tests/mysqli_get_warnings.phpt +++ b/ext/mysqli/tests/mysqli_get_warnings.phpt @@ -12,24 +12,12 @@ if (!$TEST_EXPERIMENTAL) next())) @@ -129,7 +117,7 @@ if (!$TEST_EXPERIMENTAL) if (3 != $i) printf("[034] Expecting three warnings, got %d warnings\n", $i); - $stmt = mysqli_stmt_init(); + $stmt = mysqli_stmt_init($mysqli); $warning = new mysqli_warning($stmt); if (false !== ($tmp = $warning->next())) printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt index ce1d05507539..6b4c5be41a7d 100644 --- a/ext/mysqli/tests/mysqli_info.phpt +++ b/ext/mysqli/tests/mysqli_info.phpt @@ -11,43 +11,42 @@ mysqli.allow_local_infile=1 --FILE-- = 100")) + if (false === mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100")) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "SELECT 1")) + if (false === mysqli_query($link, "SELECT 1")) printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); // NOTE: no LOAD DATA INFILE test if ($dir = sys_get_temp_dir()) { diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt index 7a2add8eb31f..484bfc4b4d90 100644 --- a/ext/mysqli/tests/mysqli_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_insert_id.phpt @@ -13,25 +13,24 @@ require_once 'skipifconnectfailure.inc'; if (0 !== ($tmp = mysqli_insert_id($link))) printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { + if (false === mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) { printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (0 !== ($tmp = mysqli_insert_id($link))) printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - mysqli_free_result($res); // no auto_increment column - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) { + if (false === mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) { printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (0 !== ($tmp = mysqli_insert_id($link))) printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) { + if (false === mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) { printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } - if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) { + if (false === mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) { printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (($last_id = mysqli_insert_id($link)) <= 0) @@ -101,13 +100,13 @@ require_once 'skipifconnectfailure.inc'; mysqli_query($link, "UNLOCK TABLE test"); } - if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) { + if (false === mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) { printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (1000 !== ($tmp = mysqli_insert_id($link))) printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp); - if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) { + if (false === mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) { printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } if (1000 >= ($tmp = mysqli_insert_id($link))) diff --git a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt index d8cdd633121e..feb890a869e4 100644 --- a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt +++ b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt @@ -4,19 +4,7 @@ INSERT and packet overflow mysqli --SKIPIF-- --INI-- memory_limit=256M diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt index 19e34caa19f4..0ed58d2ad04a 100644 --- a/ext/mysqli/tests/mysqli_kill.phpt +++ b/ext/mysqli/tests/mysqli_kill.phpt @@ -19,12 +19,10 @@ require_once 'skipifconnectfailure.inc'; if (!$thread_id = mysqli_thread_id($link)) printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_kill($link, $thread_id); - if (!is_bool($tmp)) - printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp); + mysqli_kill($link, $thread_id); if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) - pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res); + printf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res); var_dump($error = mysqli_error($link)); if (!is_string($error) || ('' === $error)) diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt index 5c1f453cb9b0..4cf99b801eb4 100644 --- a/ext/mysqli/tests/mysqli_more_results.phpt +++ b/ext/mysqli/tests/mysqli_more_results.phpt @@ -39,7 +39,7 @@ require_once 'skipifconnectfailure.inc'; // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function, // you must fetch all rows before you can loop to the next result set! // See also the MySQL Reference Manual: mysql_use_result() - while ($row = mysqli_fetch_array($res)) + while (mysqli_fetch_array($res)) ; mysqli_free_result($res); if (mysqli_more_results($link)) diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt index 618ffe2085e3..69950aec4c04 100644 --- a/ext/mysqli/tests/mysqli_multi_query.phpt +++ b/ext/mysqli/tests/mysqli_multi_query.phpt @@ -19,7 +19,7 @@ require_once 'skipifconnectfailure.inc'; $i = 0; do { $res = mysqli_store_result($link); - while ($row = mysqli_fetch_array($res)) + while (mysqli_fetch_array($res)) ; mysqli_free_result($res); $i++; @@ -33,7 +33,7 @@ require_once 'skipifconnectfailure.inc'; $i = 0; while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { - while ($row = mysqli_fetch_array($res)) + while (mysqli_fetch_array($res)) ; mysqli_free_result($res); printf("%d/%d\n", $i, mysqli_insert_id($link)); @@ -46,7 +46,7 @@ require_once 'skipifconnectfailure.inc'; $i = 0; while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) { - while ($row = mysqli_fetch_array($res)) + while (mysqli_fetch_array($res)) $i++; mysqli_free_result($res); } @@ -77,7 +77,7 @@ require_once 'skipifconnectfailure.inc'; printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link)); if (count($lengths) != 2) - printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths)); + printf("[016 - %d] Expecting 2 column lengths got %d\n", $res_num, count($lengths)); foreach ($lengths as $k => $length) if ($length <= 0) @@ -87,7 +87,7 @@ require_once 'skipifconnectfailure.inc'; } if ($num_rows != 1) - printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows); + printf("[018 - %d] Expecting 1 row, got %d rows\n", $res_num, $num_rows); $res_num++; diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt index 59a8719cbbe6..11049dfa09ec 100644 --- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt +++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt @@ -18,7 +18,7 @@ mysqlnd.net_read_timeout=1 printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); } - if (!$res = mysqli_query($link, "SELECT SLEEP(5)")) + if (false === mysqli_query($link, "SELECT SLEEP(5)")) printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_no_reconnect.phpt b/ext/mysqli/tests/mysqli_no_reconnect.phpt index d74f57557b22..929cb1dcd0c2 100644 --- a/ext/mysqli/tests/mysqli_no_reconnect.phpt +++ b/ext/mysqli/tests/mysqli_no_reconnect.phpt @@ -67,7 +67,7 @@ require_once 'skipifconnectfailure.inc'; if (false !== @mysqli_ping($link)) printf("[010] Reconnect should not have happened"); - if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) + if (@mysqli_query($link, "SELECT DATABASE() as _dbname")) printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -111,7 +111,7 @@ require_once 'skipifconnectfailure.inc'; if (false !== ($tmp = @mysqli_ping($link))) printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp); - if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname")) + if (@mysqli_query($link, "SELECT DATABASE() as _dbname")) printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt index 3022a8911524..cd24d90085c1 100644 --- a/ext/mysqli/tests/mysqli_num_fields.phpt +++ b/ext/mysqli/tests/mysqli_num_fields.phpt @@ -10,7 +10,7 @@ require_once 'skipifconnectfailure.inc'; query("SELECT id FROM test WHERE id = 1")) + if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) { printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error); return false; + } if (!$row = mysqli_fetch_assoc($res)) { printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error); diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt index 4cf28f6819e0..88b89228e111 100644 --- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt +++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt @@ -29,7 +29,7 @@ mysqli die("skip GRANT failed"); } - if (!($link_pcontest = @my_mysqli_connect($host, 'pcontest', 'pcontest', $db, $port, $socket))) { + if (!@my_mysqli_connect($host, 'pcontest', 'pcontest', $db, $port, $socket)) { mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest'); mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost'); mysqli_query($link, 'DROP USER pcontest@localhost'); @@ -56,7 +56,7 @@ mysqli.rollback_on_cached_plink=1 !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) || !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) { printf("[000] Init failed, [%d] %s\n", - mysqli_errno($plink), mysqli_error($plink)); + mysqli_errno($link), mysqli_error($link)); } try { @@ -129,9 +129,10 @@ mysqli.rollback_on_cached_plink=1 var_dump(mysqli_get_links_stats()); // this fails and we have 0 (<= $num_plinks) connections + // Do not remove the variable assignment as it is important that we have 2 active connections if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket)) printf("[010] Can connect using the old password, [%d] %s\n", - mysqli_connect_errno($link), mysqli_connect_error($link)); + mysqli_connect_errno(), mysqli_connect_error()); echo "After second pconnect:"; var_dump(mysqli_get_links_stats()); @@ -168,6 +169,7 @@ mysqli.rollback_on_cached_plink=1 mysqli_free_result($res); var_dump($row); + // Do not remove the variable assignment as it is important that we have 2 active connections if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) { printf("[015] Can open more persistent connections than allowed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); diff --git a/ext/mysqli/tests/mysqli_phpinfo.phpt b/ext/mysqli/tests/mysqli_phpinfo.phpt index d4a464e99f16..6df4e82dfd54 100644 --- a/ext/mysqli/tests/mysqli_phpinfo.phpt +++ b/ext/mysqli/tests/mysqli_phpinfo.phpt @@ -46,7 +46,7 @@ require_once 'skipifconnectfailure.inc'; 'mysqli.allow_local_infile', 'mysqli.local_infile_directory', 'mysqli.allow_persistent', 'mysqli.max_persistent' ); - foreach ($expected as $k => $entry) + foreach ($expected as $entry) if (!stristr($phpinfo, $entry)) printf("[010] Could not find entry for '%s'\n", $entry); diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt index ef1a3e055969..626f2330dcb3 100644 --- a/ext/mysqli/tests/mysqli_ping.phpt +++ b/ext/mysqli/tests/mysqli_ping.phpt @@ -18,7 +18,7 @@ require_once 'skipifconnectfailure.inc'; var_dump(mysqli_ping($link)); // provoke an error to check if mysqli_ping resets it - $res = mysqli_query($link, 'SELECT * FROM unknown_table'); + mysqli_query($link, 'SELECT * FROM unknown_table'); if (!($errno = mysqli_errno($link))) printf("[003] Statement should have caused an error\n"); diff --git a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt index 30325aa044f2..f95bc99276e2 100644 --- a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt +++ b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt @@ -44,11 +44,11 @@ require_once 'skipifconnectfailure.inc'; mysqli_close($link); $links = array(); - for ($i = 0; $i < count($queries); $i++) { + foreach ($queries as $query) { $link = get_connection(); - if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT))) + if (true !== ($tmp = mysqli_query($link, $query, MYSQLI_ASYNC | MYSQLI_USE_RESULT))) printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); // WARNING KLUDGE NOTE @@ -57,7 +57,7 @@ require_once 'skipifconnectfailure.inc'; usleep(20000); $links[mysqli_thread_id($link)] = array( - 'query' => $queries[$i], + 'query' => $query, 'link' => $link, 'processed' => false, ); @@ -66,7 +66,7 @@ require_once 'skipifconnectfailure.inc'; $saved_errors = array(); do { $poll_links = $poll_errors = $poll_reject = array(); - foreach ($links as $thread_id => $link) { + foreach ($links as $link) { if (!$link['processed']) { $poll_links[] = $link['link']; $poll_errors[] = $link['link']; @@ -93,7 +93,7 @@ require_once 'skipifconnectfailure.inc'; if (is_object($res = mysqli_reap_async_query($link))) { // result set object - while ($row = mysqli_fetch_assoc($res)) { + while (mysqli_fetch_assoc($res)) { // eat up all results ; } @@ -120,9 +120,9 @@ require_once 'skipifconnectfailure.inc'; } if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100')) - printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + printf("[005] Expecting true got %s/%s\n", gettype($res), var_export($res, true)); if (!$row = mysqli_fetch_row($res)) - printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true)); + printf("[006] Expecting true got %s/%s\n", gettype($row), var_export($row, true)); mysqli_free_result($res); } diff --git a/ext/mysqli/tests/mysqli_poll_reference.phpt b/ext/mysqli/tests/mysqli_poll_reference.phpt index 8fcb9b2fbbac..93cdc77be400 100644 --- a/ext/mysqli/tests/mysqli_poll_reference.phpt +++ b/ext/mysqli/tests/mysqli_poll_reference.phpt @@ -42,7 +42,7 @@ if (mysqli_get_server_version($link) < 50012) // WARNING: All arrays point to the same object - this will give bogus results! // The behaviour is in line with stream_select(). Be warned, be careful. $links = $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + if (0 == mysqli_poll($links, $errors, $reject, 0, 50000)) { continue; } @@ -73,7 +73,7 @@ if (mysqli_get_server_version($link) < 50012) // WARNING: All arrays point to the same object - this will give bogus results! $links = $errors = array($mysqli1, $mysqli2); $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + if (0 == mysqli_poll($links, $errors, $reject, 0, 50000)) { continue; } foreach ($links as $link) { @@ -103,7 +103,7 @@ if (mysqli_get_server_version($link) < 50012) // WARNING: All arrays point to the same object - this will give bogus results! $links = array($mysqli1, $mysqli2); $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + if (0 == mysqli_poll($links, $errors, $reject, 0, 50000)) { continue; } foreach ($links as $link) { @@ -133,7 +133,7 @@ if (mysqli_get_server_version($link) < 50012) break; } $links = $errors = $reject = array($mysqli1, $mysqli2); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + if (0 == mysqli_poll($links, $errors, $reject, 0, 50000)) { continue; } // WARNING: Due to the reference issue none of these should ever fire! @@ -176,7 +176,7 @@ if (mysqli_get_server_version($link) < 50012) } $links = $errors = $reject = $all; ob_start(); - if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) { + if (0 == mysqli_poll($links, $errors, $reject, 0, 50000)) { $tmp = ob_get_contents(); ob_end_clean(); if ($tmp != '') { @@ -193,7 +193,7 @@ if (mysqli_get_server_version($link) < 50012) } } while ($processed < 2); - $ready = mysqli_poll($links, $errors, $reject, 0, 50000); + mysqli_poll($links, $errors, $reject, 0, 50000); mysqli_close($mysqli1); mysqli_close($mysqli2); diff --git a/ext/mysqli/tests/mysqli_prepare_no_object.phpt b/ext/mysqli/tests/mysqli_prepare_no_object.phpt index c488cbe50591..7ef3728535fe 100644 --- a/ext/mysqli/tests/mysqli_prepare_no_object.phpt +++ b/ext/mysqli/tests/mysqli_prepare_no_object.phpt @@ -11,11 +11,11 @@ require_once 'skipifconnectfailure.inc'; require 'table.inc'; if (false !== ($tmp = mysqli_prepare($link, false))) - printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); if (false !== ($tmp = mysqli_prepare($link, ''))) - printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link)); mysqli_close($link); @@ -23,11 +23,11 @@ require_once 'skipifconnectfailure.inc'; $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket); if (false !== ($tmp = $mysqli->prepare(false))) - printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); if (false !== ($tmp = $mysqli->prepare(''))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp)); + printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true)); printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error); print "done!"; diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt index adb416708fc0..640dbacaaf2c 100644 --- a/ext/mysqli/tests/mysqli_query.phpt +++ b/ext/mysqli/tests/mysqli_query.phpt @@ -45,7 +45,7 @@ require_once 'skipifconnectfailure.inc'; // let's try to play with stored procedures mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'); if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) { - $res = mysqli_query($link, 'CALL p(@version)'); + mysqli_query($link, 'CALL p(@version)'); $res = mysqli_query($link, 'SELECT @version AS p_version'); $tmp = mysqli_fetch_assoc($res); diff --git a/ext/mysqli/tests/mysqli_query_iterators.phpt b/ext/mysqli/tests/mysqli_query_iterators.phpt index ea48fa864db9..91acc529f90c 100644 --- a/ext/mysqli/tests/mysqli_query_iterators.phpt +++ b/ext/mysqli/tests/mysqli_query_iterators.phpt @@ -25,7 +25,8 @@ require_once 'skipifconnectfailure.inc'; mysqli_free_result($res); try { foreach ($res as $row) { - $row; + echo "Iterating over a closed result set should not work\n"; + var_dump($row); } } catch (Error $exception) { echo $exception->getMessage() . "\n"; diff --git a/ext/mysqli/tests/mysqli_query_stored_proc.phpt b/ext/mysqli/tests/mysqli_query_stored_proc.phpt index dbd22fbb38f4..e9590e4a5540 100644 --- a/ext/mysqli/tests/mysqli_query_stored_proc.phpt +++ b/ext/mysqli/tests/mysqli_query_stored_proc.phpt @@ -107,8 +107,7 @@ END;')) { if (!$res = mysqli_query($link, 'SELECT @version as _vers')) printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res) || - $row['_vers'] == 'unknown') + if (!($row = mysqli_fetch_assoc($res)) || $row['_vers'] == 'unknown') printf("[015] Results seem wrong, got %s, [%d] %s\n", $row['_vers'], mysqli_errno($link), mysqli_error($link)); @@ -135,8 +134,7 @@ END;')) { if (!$res = mysqli_query($link, 'SELECT @version as _vers')) printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (!$row = mysqli_fetch_assoc($res) || - $row['_vers'] == 'myversion') + if (!($row = mysqli_fetch_assoc($res)) || $row['_vers'] !== 'myversion') printf("[022] Results seem wrong, got %s, [%d] %s\n", $row['_vers'], mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt index c8c9e052de94..0e4a1095cf8d 100644 --- a/ext/mysqli/tests/mysqli_query_unicode.phpt +++ b/ext/mysqli/tests/mysqli_query_unicode.phpt @@ -40,7 +40,7 @@ mysqli_close($link); // let's try to play with stored procedures mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка'); if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT версия VARCHAR(25)) BEGIN SELECT VERSION() INTO версия; END;')) { - $res = mysqli_query($link, 'CALL процедурка(@version)'); + mysqli_query($link, 'CALL процедурка(@version)'); $res = mysqli_query($link, 'SELECT @version AS п_версия'); $tmp = mysqli_fetch_assoc($res); diff --git a/ext/mysqli/tests/mysqli_real_connect_compression_error.phpt b/ext/mysqli/tests/mysqli_real_connect_compression_error.phpt index 7a452d3a23cf..ad595366c317 100644 --- a/ext/mysqli/tests/mysqli_real_connect_compression_error.phpt +++ b/ext/mysqli/tests/mysqli_real_connect_compression_error.phpt @@ -24,7 +24,7 @@ $data_size = 16777174; // Insert with compression disabled: $mysqli = mysqli_init(); -$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket); +my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket); $mysqli->query("DROP TABLE IF EXISTS test"); $mysqli->query("CREATE TABLE test (`blob` LONGBLOB NOT NULL) ENGINE=MyISAM"); @@ -37,7 +37,7 @@ $mysqli->close(); // Insert with compression enabled: $mysqli = mysqli_init(); -$result = my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS); +my_mysqli_real_connect($mysqli, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS); $data = str_repeat("x", $data_size); $mysqli->query("INSERT INTO $db.test(`blob`) VALUE ('$data')"); diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt index 19f907bd4a36..fae4f91a1d9c 100644 --- a/ext/mysqli/tests/mysqli_reap_async_query.phpt +++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt @@ -18,10 +18,6 @@ require_once 'skipifconnectfailure.inc'; return $link; } - if (!$link = get_connection()) - printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - - function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) { if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000))) diff --git a/ext/mysqli/tests/mysqli_reap_async_query_error.phpt b/ext/mysqli/tests/mysqli_reap_async_query_error.phpt index e7de2b6c9fe9..f7cbfbd363ed 100644 --- a/ext/mysqli/tests/mysqli_reap_async_query_error.phpt +++ b/ext/mysqli/tests/mysqli_reap_async_query_error.phpt @@ -19,7 +19,7 @@ mysqli::poll($reads, $errors, $rejects, 1); $link = $reads[0]; try { - $rs = $link->reap_async_query(); + $link->reap_async_query(); } catch (mysqli_sql_exception $exception) { echo $exception->getMessage() . "\n"; } diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt index 8c896af7657a..f1d7fba992d3 100644 --- a/ext/mysqli/tests/mysqli_release_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt @@ -36,7 +36,7 @@ if (!have_innodb($link)) /* note that there is no savepoint my... */ if (false !== ($tmp = mysqli_release_savepoint($link, 'my'))) - printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + printf("[010] Got %s - [%d] %s\n", $tmp, mysqli_errno($link), mysqli_error($link)); if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -46,13 +46,13 @@ if (!have_innodb($link)) printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); if (true !== ($tmp = mysqli_savepoint($link, 'my'))) - printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + printf("[013] Got %s - [%d] %s\n", $tmp, mysqli_errno($link), mysqli_error($link)); $res = mysqli_query($link, "SELECT * FROM test"); var_dump($res->fetch_assoc()); if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) - printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + printf("[014] Got %s - [%d] %s\n", $tmp, mysqli_errno($link), mysqli_error($link)); print "done!"; ?> diff --git a/ext/mysqli/tests/mysqli_report.phpt b/ext/mysqli/tests/mysqli_report.phpt index afde537aee4d..19b70a0f2b46 100644 --- a/ext/mysqli/tests/mysqli_report.phpt +++ b/ext/mysqli/tests/mysqli_report.phpt @@ -55,7 +55,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); while(mysqli_more_results($link)) { mysqli_next_result($link); - $res = mysqli_store_result($link); + mysqli_store_result($link); } mysqli_next_result($link); @@ -85,7 +85,7 @@ require_once 'skipifconnectfailure.inc'; mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?"); while(mysqli_more_results($link)) { mysqli_next_result($link); - $res = mysqli_store_result($link); + mysqli_store_result($link); } mysqli_next_result($link); @@ -211,8 +211,6 @@ require_once 'skipifconnectfailure.inc'; TODO: */ - $log_slow_queries = false; - $log_queries_not_using_indexes = false; mysqli_report(MYSQLI_REPORT_OFF); mysqli_report(MYSQLI_REPORT_INDEX); @@ -227,7 +225,7 @@ require_once 'skipifconnectfailure.inc'; if (!$row = mysqli_fetch_assoc($res)) printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $log_slow_query = ('ON' == $row['Value']); + $log_slow_queries = ('ON' == $row['Value']); if (mysqli_get_server_version($link) >= 50111) { // this might cause a warning - no index used @@ -301,8 +299,6 @@ require_once 'skipifconnectfailure.inc'; !mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT)) printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $tmp = mysqli_thread_id($link); - mysqli_close($link); print "done!"; ?> diff --git a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt index f0799120742b..1b9c8601ba7c 100644 --- a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt +++ b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt @@ -15,7 +15,6 @@ require_once 'skipifconnectfailure.inc'; exit(1); } - $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT); $invalidModes = [-1, 152]; foreach ($invalidModes as $mode) { try { diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt index 810a0842498e..0de39d7d7154 100644 --- a/ext/mysqli/tests/mysqli_savepoint.phpt +++ b/ext/mysqli/tests/mysqli_savepoint.phpt @@ -36,7 +36,7 @@ if (!have_innodb($link)) /* overrule autocommit */ if (true !== ($tmp = mysqli_savepoint($link, 'my'))) - printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); + printf("[010] Got %s - [%d] %s\n", $tmp, mysqli_errno($link), mysqli_error($link)); if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt index 33c55c12409c..a0c38ebbb676 100644 --- a/ext/mysqli/tests/mysqli_select_db.phpt +++ b/ext/mysqli/tests/mysqli_select_db.phpt @@ -45,7 +45,7 @@ require_once 'skipifconnectfailure.inc'; } if (!$link->select_db($db)) - printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error); + printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $db, $link->errno, $link->error); if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname")) printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -81,9 +81,9 @@ require_once 'skipifconnectfailure.inc'; if (!$res = $link->query("SELECT id FROM test WHERE id = 1")) - printf("[018] [%d] %s\n"); + printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $row = $res->fetch_assoc(); + $res->fetch_assoc(); $res->free(); mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt index 4dff9668b531..4a873f65eb43 100644 --- a/ext/mysqli/tests/mysqli_set_charset.phpt +++ b/ext/mysqli/tests/mysqli_set_charset.phpt @@ -17,7 +17,6 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR mysqli_close($link); } else { die(sprintf("skip Requires character set latin1 or latin2\n")); - mysqli_close($link); } ?> --FILE-- diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt index d58aa0863d87..4417cb265b80 100644 --- a/ext/mysqli/tests/mysqli_stat.phpt +++ b/ext/mysqli/tests/mysqli_stat.phpt @@ -17,7 +17,7 @@ require_once 'skipifconnectfailure.inc'; if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp)) printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link)); + gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); mysqli_close($link); diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt index 942711faa141..f7de1e04c604 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt @@ -11,9 +11,9 @@ require_once 'skipifconnectfailure.inc'; require 'table.inc'; $valid_attr = array( - "max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, - "cursor_type" => MYSQLI_STMT_ATTR_CURSOR_TYPE, - "prefetch_rows" => MYSQLI_STMT_ATTR_PREFETCH_ROWS, + MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, + MYSQLI_STMT_ATTR_CURSOR_TYPE, + MYSQLI_STMT_ATTR_PREFETCH_ROWS, ); $stmt = mysqli_stmt_init($link); @@ -25,17 +25,17 @@ require_once 'skipifconnectfailure.inc'; echo $e->getMessage() . \PHP_EOL; } - foreach ($valid_attr as $k => $attr) { - /* This can't happen anymore as it only returns int */ - if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) { - printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n", - gettype($tmp), $tmp, $k, $attr); + foreach ($valid_attr as $attr) { + try { + mysqli_stmt_attr_get($stmt, $attr); + } catch (Throwable $exception) { + echo $exception->getMessage() . "\n"; } } $stmt->close(); - foreach ($valid_attr as $k => $attr) { + foreach ($valid_attr as $attr) { try { mysqli_stmt_attr_get($stmt, $attr); } catch (Throwable $exception) { diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt index 304046919a1a..070d4a389bca 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt @@ -10,15 +10,6 @@ require_once 'skipifconnectfailure.inc'; store_result(); $res = $stmt->result_metadata(); $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; + foreach ($fields as $meta) { if ($meta->max_length !== 0) printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); } @@ -71,9 +60,7 @@ require_once 'skipifconnectfailure.inc'; $stmt->store_result(); $res = $stmt->result_metadata(); $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; + foreach ($fields as $meta) { if ($meta->max_length !== 0) printf("[008] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); } @@ -91,9 +78,7 @@ require_once 'skipifconnectfailure.inc'; $stmt->store_result(); $res = $stmt->result_metadata(); $fields = $res->fetch_fields(); - $max_lengths = array(); - foreach ($fields as $k => $meta) { - $max_lengths[$meta->name] = $meta->max_length; + foreach ($fields as $meta) { if ($meta->max_length !== 0) printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name); } diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt index 180de7cc43f2..c4b0c21f2586 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt @@ -382,14 +382,14 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - foreach ($value_list as $k => $values) { + foreach ($value_list as $values) { if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) { printf("[2011] bind_param() failed for id = %d, [%d] %s\n", $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); continue; } if (!$stmt->execute()) - printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n", + printf("[2012] execute() failed for id = %d, [%d] %s\n", $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id']))) diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt index 40296ad63d2d..844d2974af00 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt @@ -309,7 +309,6 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?')) printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $types = 'i'; $id = 1; $params = array( 0 => $stmt, diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt index 5a210f3d2e35..d4d61380ff2e 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt @@ -275,7 +275,7 @@ require_once 'skipifconnectfailure.inc'; try { mysqli_stmt_bind_result($stmt, $id); } catch (\ArgumentCountError $e) { - $e->getMessage() . \PHP_EOL; + echo $e->getMessage() . \PHP_EOL; } mysqli_stmt_close($stmt); @@ -293,4 +293,5 @@ Number of bind variables doesn't match number of fields in prepared statement Number of bind variables doesn't match number of fields in prepared statement int(1) %s(1) "a" +Number of bind variables doesn't match number of fields in prepared statement done! diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt index d031077009a0..89d278060161 100644 --- a/ext/mysqli/tests/mysqli_stmt_close.phpt +++ b/ext/mysqli/tests/mysqli_stmt_close.phpt @@ -23,8 +23,7 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_close($stmt); try { mysqli_stmt_close($stmt); @@ -48,8 +47,7 @@ require_once 'skipifconnectfailure.inc'; $link->query('KILL '.mysqli_thread_id($link)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_close($stmt); mysqli_close($link); @@ -69,8 +67,7 @@ require_once 'skipifconnectfailure.inc'; $link->query('KILL '.mysqli_thread_id($link)); - if (true !== ($tmp = mysqli_stmt_close($stmt))) - printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_close($stmt); print "done!"; ?> diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt index 21f8286cac08..a36daebc7951 100644 --- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt @@ -33,24 +33,21 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_store_result($stmt)) printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2))) - printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_data_seek($stmt, 2); if (!mysqli_stmt_fetch($stmt)) printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); var_dump($id); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0))) - printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_data_seek($stmt, 0); if (!mysqli_stmt_fetch($stmt)) printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); var_dump($id); - if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100))) - printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100); if (mysqli_stmt_fetch($stmt)) printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt index bdfc9c348ae2..03c070dad482 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt @@ -52,7 +52,7 @@ if (mysqli_get_server_version($link) < 50503) { if (!mysqli_stmt_close($stmt)) printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (!$res = $link->query("SELECT 1")) + if (false === $link->query("SELECT 1")) printf("[013] [%d] %s\n", $link->errno, $link->error); } else { diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt index 48e2e6f8dec6..90348833e57f 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt @@ -17,7 +17,7 @@ require_once 'skipifconnectfailure.inc'; !mysqli_stmt_execute($stmt) || !($result = mysqli_stmt_result_metadata($stmt)) || !mysqli_stmt_bind_result($stmt, $id, $bind_res) || - !($fields = mysqli_fetch_fields($result))) { + [] === mysqli_fetch_fields($result)) { printf("FAIL 1\n"); } while (mysqli_stmt_fetch($stmt)) { @@ -34,7 +34,7 @@ require_once 'skipifconnectfailure.inc'; printf("FAIL 2\n"); } print "OK: 1\n"; - if (!($fields = mysqli_fetch_fields($result))) + if ([] === mysqli_fetch_fields($result)) printf("Aua 3\n"); print "OK: 2\n"; while (mysqli_stmt_fetch($stmt)) { diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt index e049e8410477..d512a23ee037 100644 --- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt @@ -28,14 +28,12 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_free_result($stmt); if (!mysqli_stmt_execute($stmt)) printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_free_result($stmt); if (false !== ($tmp = mysqli_stmt_store_result($stmt))) printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); @@ -54,8 +52,7 @@ require_once 'skipifconnectfailure.inc'; if (true !== ($tmp = mysqli_stmt_store_result($stmt))) printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (NULL !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + mysqli_stmt_free_result($stmt); mysqli_stmt_close($stmt); diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt index a5352af94db8..5178d2b60975 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt @@ -102,7 +102,7 @@ require_once 'skipifconnectfailure.inc'; if (!mysqli_stmt_bind_result($stmt, $id, $label)) printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); - $row = mysqli_fetch_assoc($res); + mysqli_fetch_assoc($res); if (NULL !== $id || NULL !== $label) printf("[021] Bound variables should not have been set\n"); mysqli_free_result($res); diff --git a/ext/mysqli/tests/mysqli_stmt_multires.phpt b/ext/mysqli/tests/mysqli_stmt_multires.phpt index 0352a464e86f..94538cbc5d8d 100644 --- a/ext/mysqli/tests/mysqli_stmt_multires.phpt +++ b/ext/mysqli/tests/mysqli_stmt_multires.phpt @@ -10,7 +10,6 @@ require_once 'skipifconnectfailure.inc'; query('DROP PROCEDURE IF EXISTS p123')) { printf("[001] [%d] %s\n", $link->error, $link->errno); } diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt index a29da62893fb..8d73967777a6 100644 --- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt @@ -23,7 +23,7 @@ require_once 'skipifconnectfailure.inc'; printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); if (!is_object(($res = mysqli_stmt_result_metadata($stmt)))) - printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp); + printf("[006] Expecting object, got %s/%s\n", gettype($res), $res); if (2 !== ($tmp = mysqli_num_fields($res))) printf("[007] Expecting int/2, got %s/%s, [%d] %s\n", @@ -45,9 +45,7 @@ require_once 'skipifconnectfailure.inc'; var_dump($field0_fetch); - if (!is_array($tmp = mysqli_fetch_fields($res))) - printf("[011] Expecting array, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + $tmp = mysqli_fetch_fields($res); if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) { printf("[012] mysqli_fetch_fields() return value is suspicious\n"); diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt index cc4a92727091..dbf8dddb88e4 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt @@ -64,7 +64,7 @@ require_once 'skipifconnectfailure.inc'; assert(strlen($blob) <= $max_allowed_packet); try { - $tmp = mysqli_stmt_send_long_data($stmt, -1, $blob); + mysqli_stmt_send_long_data($stmt, -1, $blob); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt index 5c7ffd9c6da4..79cf0aa79450 100644 --- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt +++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt @@ -40,8 +40,6 @@ require_once 'skipifconnectfailure.inc'; // let's ignore upper limits for LONGBLOB (2^32) ... // maximum packet size up to which we test is 10M - $tmp = ''; - $blob = ''; $tmp = str_repeat('a', 1024); $limit = min(floor($max_allowed_packet / 1024 / 2), 10240); diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt index f3d743916b7c..2a35320a63ae 100644 --- a/ext/mysqli/tests/mysqli_store_result.phpt +++ b/ext/mysqli/tests/mysqli_store_result.phpt @@ -10,7 +10,7 @@ require_once 'skipifconnectfailure.inc';