uw Thu, 01 Sep 2011 13:17:16 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=315985
Log: Check if MySQL server supports SSL and, if using mysqlnd, check if PHP streams will support SSL Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug55283.phpt U php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug51647.phpt U php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug55283.phpt U php/php-src/trunk/ext/mysqli/tests/bug51647.phpt U php/php-src/trunk/ext/mysqli/tests/bug55283.phpt
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,6 +4,35 @@ <?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 Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug55283.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,15 +4,35 @@ <?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 Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug51647.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,6 +4,35 @@ <?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 Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug55283.phpt =================================================================== --- php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,15 +4,35 @@ <?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 Modified: php/php-src/trunk/ext/mysqli/tests/bug51647.phpt =================================================================== --- php/php-src/trunk/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/trunk/ext/mysqli/tests/bug51647.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,6 +4,35 @@ <?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 Modified: php/php-src/trunk/ext/mysqli/tests/bug55283.phpt =================================================================== --- php/php-src/trunk/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:06:12 UTC (rev 315984) +++ php/php-src/trunk/ext/mysqli/tests/bug55283.phpt 2011-09-01 13:17:16 UTC (rev 315985) @@ -4,15 +4,35 @@ <?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
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php