Skip to content

Commit 6b7cb4a

Browse files
committed
Fix mysqli ssl tests
First, make sure the tests are skipped if we connect via unix socket, as we can't use SSL in that case. Second, use a cipher that is not blacklisted in current MySQL versions.
1 parent ee4295b commit 6b7cb4a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ext/mysqli/tests/bug51647.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ if ($IS_MYSQLND && !extension_loaded("openssl"))
1212
if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
1313
die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
1414

15+
if (false === strpos($link->host_info, 'TCP/IP'))
16+
die(sprintf("skip SSL only supported on TCP/IP"));
17+
1518
$row = NULL;
1619
if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
1720
$row = $res->fetch_row();

ext/mysqli/tests/bug55283.phpt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ if ($IS_MYSQLND && !extension_loaded("openssl"))
1212
if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
1313
die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
1414

15+
if (false === strpos($link->host_info, 'TCP/IP'))
16+
die(sprintf("skip SSL only supported on TCP/IP"));
17+
1518
$row = NULL;
1619
if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
1720
$row = $res->fetch_row();
@@ -36,22 +39,22 @@ $link->close();
3639
?>
3740
--FILE--
3841
<?php
39-
include "connect.inc";
42+
require_once "connect.inc";
4043
$db1 = new mysqli();
4144

4245

4346
$flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
4447

4548
$link = mysqli_init();
46-
mysqli_ssl_set($link, null, null, null, null, "RC4-MD5");
49+
mysqli_ssl_set($link, null, null, null, null, "AES256-SHA");
4750
if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) {
4851
$r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
4952
var_dump($r->fetch_row());
5053
}
5154

5255
/* non-persistent connection */
5356
$link2 = mysqli_init();
54-
mysqli_ssl_set($link2, null, null, null, null, "RC4-MD5");
57+
mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA");
5558
if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) {
5659
$r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'");
5760
var_dump($r2->fetch_row());
@@ -64,12 +67,12 @@ array(2) {
6467
[0]=>
6568
string(10) "Ssl_cipher"
6669
[1]=>
67-
string(7) "RC4-MD5"
70+
string(10) "AES256-SHA"
6871
}
6972
array(2) {
7073
[0]=>
7174
string(10) "Ssl_cipher"
7275
[1]=>
73-
string(7) "RC4-MD5"
76+
string(10) "AES256-SHA"
7477
}
7578
done

0 commit comments

Comments
 (0)