Skip to content

Update mysqli tests to work with newer MySQL server #6729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions ext/mysqli/tests/mysqli_pam_sha256.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ if (strlen($row['Value']) < 100) {
die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
}

if (!$link->query("SET @@session.old_passwords=2")) {
die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
}
// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
$link->query("SET @@session.old_passwords=2");

$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
Expand All @@ -58,8 +57,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}

if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}

Expand Down
10 changes: 4 additions & 6 deletions ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ if (strlen($key) != fwrite($fp, $key)) {
die(sprintf("skip Failed to create pub key file"));
}


if (!$link->query("SET @@session.old_passwords=2")) {
die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
}
// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
$link->query("SET @@session.old_passwords=2");

$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
Expand All @@ -71,8 +69,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}

if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}

Expand Down
10 changes: 4 additions & 6 deletions ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
die(sprintf("skip Failed to create pub key file"));
}


if (!$link->query("SET @@session.old_passwords=2")) {
die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
}
// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
$link->query("SET @@session.old_passwords=2");

$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
Expand All @@ -68,8 +66,8 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}

if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
die(sprintf("skip Failed to create pub key file"));
}


if (!$link->query("SET @@session.old_passwords=2")) {
die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
}
// Ignore errors because this variable exists only in MySQL 5.6 and 5.7
$link->query("SET @@session.old_passwords=2");

$link->query('DROP USER shatest');
$link->query("DROP USER shatest@localhost");
Expand All @@ -68,13 +66,12 @@ if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
}

if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
if (!$link->query('SET PASSWORD FOR shatest@"%" = "shatest"') ||
!$link->query('SET PASSWORD FOR shatest@"localhost" = "shatest"')) {
die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
}

if (!$link->query("DROP TABLE IF EXISTS test") ||
!$link->query("CREATE TABLE test (id INT)") ||
if (!$link->query("CREATE TABLE test (id INT)") ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did the drop table get dropped here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged this PR without this change.

!$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));

Expand Down