Skip to content

Commit

Permalink
Remove support for libmysql-client from mysqli test suite
Browse files Browse the repository at this point in the history
Since mysqli can no longer be built against libmysql-client, there is
no longer the need to distinguish.

While we're at it, we also drop the superfluous is_object() checks.

Closes GH-9652.
  • Loading branch information
cmb69 committed Oct 6, 2022
1 parent fe9e857 commit 62d393b
Show file tree
Hide file tree
Showing 69 changed files with 304 additions and 569 deletions.
36 changes: 4 additions & 32 deletions ext/mysqli/tests/071.phpt
Expand Up @@ -16,22 +16,8 @@ require_once('skipifconnectfailure.inc');
var_dump($mysql->ping());

$ret = $mysql->kill($mysql->thread_id);
if ($IS_MYSQLND) {
if ($ret !== true){
printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
}
} else {
/* libmysql return value seems to depend on server version */
if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
/* TODO: find exact version */
if ($ret !== true){
printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
}
} else {
if ($ret !== false){
printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
}
}
if ($ret !== true){
printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
}

var_dump($mysql->ping());
Expand All @@ -43,22 +29,8 @@ require_once('skipifconnectfailure.inc');
var_dump(mysqli_ping($mysql));

$ret = $mysql->kill($mysql->thread_id);
if ($IS_MYSQLND) {
if ($ret !== true){
printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
}
} else {
/* libmysql return value seems to depend on server version */
if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
/* TODO: find exact version */
if ($ret !== true){
printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
}
} else {
if ($ret !== false){
printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
}
}
if ($ret !== true){
printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
}

var_dump(mysqli_ping($mysql));
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/tests/bug38710.phpt
Expand Up @@ -16,7 +16,7 @@ $qry->prepare("SELECT REPEAT('a',100000)");
$qry->execute();
$qry->bind_result($text);
$qry->fetch();
if ($text !== str_repeat('a', ($IS_MYSQLND || mysqli_get_server_version($db) > 50110)? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) {
if ($text !== str_repeat('a', 100000)) {
var_dump(strlen($text));
}
echo "Done";
Expand Down
4 changes: 0 additions & 4 deletions ext/mysqli/tests/bug44897.phpt
Expand Up @@ -6,10 +6,6 @@ mysqli
<?php
require_once 'connect.inc';

if (!$IS_MYSQLND) {
die("skip: only available in mysqlnd");
}

if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
}
Expand Down
10 changes: 2 additions & 8 deletions ext/mysqli/tests/bug45019.phpt
Expand Up @@ -33,15 +33,9 @@ require_once('skipifconnectfailure.inc');

$index = 0;
while ($stmt->fetch()) {
/* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
if ($data[$index] != $column1) {
if ($IS_MYSQLND || $index != 1) {
printf("[004] Row %d, expecting %s/%s got %s/%s\n",
$index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
} else {
if ($column1 != "thre")
printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
}
printf("[004] Row %d, expecting %s/%s got %s/%s\n",
$index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
}
$index++;
}
Expand Down
5 changes: 1 addition & 4 deletions ext/mysqli/tests/bug45289.phpt
Expand Up @@ -25,10 +25,7 @@ require_once('skipifconnectfailure.inc');
printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);

if ($res = $link->store_result()) {
if ($IS_MYSQLND)
printf("[004] Can store result!\n");
else
printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
printf("[004] Can store result!\n");
} else {
printf("[004] [%d] %s\n", $link->errno, $link->error);
}
Expand Down
64 changes: 31 additions & 33 deletions ext/mysqli/tests/bug49442.phpt
Expand Up @@ -63,45 +63,43 @@ mysqli.max_persistent=1
mysqli_query($link, "DELETE FROM test");
mysqli_close($link);

if ($IS_MYSQLND) {
/*
mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc.
It's only about malloc() vs. emalloc().
However, the bug is about malloc() and efree(). You can make mysqlnd use malloc() by either using
pconnect or mysql_init() - so we should test pconnect as well.
*/
$host = 'p:' . $host;
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
/*
mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc.
It's only about malloc() vs. emalloc().
However, the bug is about malloc() and efree(). You can make mysqlnd use malloc() by either using
pconnect or mysql_init() - so we should test pconnect as well.
*/
$host = 'p:' . $host;
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}

/* bug happened during query processing */
if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
INTO TABLE test
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
LINES TERMINATED BY '\n'",
mysqli_real_escape_string($link, $file)))) {
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
/* bug happened during query processing */
if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
INTO TABLE test
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
LINES TERMINATED BY '\n'",
mysqli_real_escape_string($link, $file)))) {
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}

/* we survived? that's good enough... */
/* we survived? that's good enough... */

if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));

$i = 0;
while ($row = mysqli_fetch_assoc($res)) {
if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
printf("[010] Wrong values, check manually!\n");
}
$i++;
$i = 0;
while ($row = mysqli_fetch_assoc($res)) {
if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
printf("[010] Wrong values, check manually!\n");
}
mysqli_close($link);
$i++;
}
mysqli_close($link);

print "done!";
?>
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/tests/bug51647.phpt
Expand Up @@ -9,7 +9,7 @@ require_once "connect.inc";
if (!defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'))
die("skip Requires MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT");

if ($IS_MYSQLND && !extension_loaded("openssl"))
if (!extension_loaded("openssl"))
die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");

if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug52891.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once('skipifconnectfailure.inc');
if (!$IS_MYSQLND) {
die("skip: test applies only to mysqlnd");
}
?>
--FILE--
<?php
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqli/tests/bug55283.phpt
Expand Up @@ -9,7 +9,7 @@ require_once "connect.inc";
if (!defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'))
die("skip Requires MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT");

if ($IS_MYSQLND && !extension_loaded("openssl"))
if (!extension_loaded("openssl"))
die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");

if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug62885.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once("connect.inc");
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug63398.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once "skipifconnectfailure.inc";
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug64726.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once "skipifconnectfailure.inc";
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug67983.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once('skipifconnectfailure.inc');
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug68077.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once 'connect.inc';
if (!$IS_MYSQLND) {
die("skip: test applies only to mysqlnd");
}
if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
}
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug69899.phpt
Expand Up @@ -11,9 +11,6 @@ mysqli
--SKIPIF--
<?php
require_once __DIR__ . '/skipifconnectfailure.inc';
if (!$IS_MYSQLND) {
die('skip mysqlnd only');
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug70949.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug71863.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/bug77935.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once('skipifconnectfailure.inc');
if (!$IS_MYSQLND) {
die("skip mysqlnd only test");
}
?>
--FILE--
<?php
Expand Down
2 changes: 0 additions & 2 deletions ext/mysqli/tests/connect.inc
Expand Up @@ -25,8 +25,6 @@
/* Development setting: test experimental features and/or feature requests that never worked before? */
$TEST_EXPERIMENTAL = 1 == getenv("MYSQL_TEST_EXPERIMENTAL");

$IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");

if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() {

Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/gh7837.phpt
Expand Up @@ -5,9 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
if (!$IS_MYSQLND) {
die("skip requires mysqlnd");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/gh9590.phpt
Expand Up @@ -7,9 +7,6 @@ posix
<?php
require_once('skipifconnectfailure.inc');

if (!$IS_MYSQLND)
die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");

if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die("skip cannot connect");

Expand Down
4 changes: 0 additions & 4 deletions ext/mysqli/tests/mysqli_change_user_insert_id.phpt
Expand Up @@ -5,10 +5,6 @@ mysqli
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';

if (!$IS_MYSQLND) {
die("skip Might hit known and open bugs http://bugs.mysql.com/bug.php?id=30472, http://bugs.mysql.com/bug.php?id=45184");
}
?>
--FILE--
<?php
Expand Down
3 changes: 0 additions & 3 deletions ext/mysqli/tests/mysqli_change_user_oo.phpt
Expand Up @@ -7,9 +7,6 @@ mysqli
require_once 'skipifconnectfailure.inc';

require_once 'table.inc';
if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_server_version($link) > 50100)) {
die("skip Your MySQL Server version has a known bug that will cause a crash");
}

if (mysqli_get_server_version($link) >= 50600)
die("SKIP For MySQL < 5.6.0");
Expand Down
11 changes: 4 additions & 7 deletions ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
Expand Up @@ -61,13 +61,10 @@ require_once('skipifconnectfailure.inc');
'use_result' => true,
);

if ($IS_MYSQLND) {
// mysqlnd only
/* $expected_methods['get_client_stats'] = true; */
$expected_methods['get_connection_stats'] = true;
$expected_methods['reap_async_query'] = true;
$expected_methods['poll'] = true;
}
/* $expected_methods['get_client_stats'] = true; */
$expected_methods['get_connection_stats'] = true;
$expected_methods['reap_async_query'] = true;
$expected_methods['poll'] = true;

/* we should add ruled when to expect them */
if (function_exists('mysqli_debug'))
Expand Down

0 comments on commit 62d393b

Please sign in to comment.