summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Wendel <uw@php.net>2011-09-01 13:17:16 +0000
committerUlf Wendel <uw@php.net>2011-09-01 13:17:16 +0000
commit3eb3eb406ea5b5bcf790a43cb17352bb0ecf94e5 (patch)
treed13b023adc1b8b0c895f5865c6fc4ee43ca44919
parent958326c8434201054e99b8597e8d7365140bd821 (diff)
downloadphp-git-3eb3eb406ea5b5bcf790a43cb17352bb0ecf94e5.tar.gz
Check if MySQL server supports SSL and, if using mysqlnd, check if PHP streams will support SSL
-rw-r--r--ext/mysqli/tests/bug51647.phpt29
-rw-r--r--ext/mysqli/tests/bug55283.phpt32
2 files changed, 55 insertions, 6 deletions
diff --git a/ext/mysqli/tests/bug51647.phpt b/ext/mysqli/tests/bug51647.phpt
index 833f8edbbb..b1c1e87a77 100644
--- a/ext/mysqli/tests/bug51647.phpt
+++ b/ext/mysqli/tests/bug51647.phpt
@@ -4,6 +4,35 @@ Bug #51647 (Certificate file without private key (pk in another file) doesn't wo
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
+require_once("connect.inc");
+
+if ($IS_MYSQLND && !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)))
+ die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+
+$row = NULL;
+if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
+ $row = $res->fetch_row();
+} else {
+ if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
+ while ($row = $res->fetch_row())
+ if ($row[0] == 'have_ssl')
+ break;
+ } else {
+ die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+ }
+}
+
+
+if (empty($row))
+ die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+
+if ($row[1] == 'NO')
+ die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
+
+$link->close();
?>
--FILE--
<?php
diff --git a/ext/mysqli/tests/bug55283.phpt b/ext/mysqli/tests/bug55283.phpt
index 0611c773cf..6000fce0a9 100644
--- a/ext/mysqli/tests/bug55283.phpt
+++ b/ext/mysqli/tests/bug55283.phpt
@@ -4,15 +4,35 @@ Bug #55283 (SSL options set by mysqli_ssl_set ignored for MySQLi persistent conn
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
-$link = mysqli_init();
-mysqli_ssl_set($link, null, null, null, null, "RC4-MD5");
-if (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, null, $flags)) {
- $res = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
+require_once("connect.inc");
+
+if ($IS_MYSQLND && !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)))
+ die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+
+$row = NULL;
+if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
$row = $res->fetch_row();
- if ($row[1] === "") {
- die('skip Server started without SSL support');
+} else {
+ if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
+ while ($row = $res->fetch_row())
+ if ($row[0] == 'have_ssl')
+ break;
+ } else {
+ die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
}
}
+
+
+if (empty($row))
+ die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+
+if ($row[1] == 'NO')
+ die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
+
+$link->close();
?>
--FILE--
<?php