File: bug51647.phpt

package info (click to toggle)
php5 5.3.3-7%2Bsqueeze19
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 122,836 kB
  • ctags: 55,742
  • sloc: ansic: 633,963; php: 19,620; sh: 11,344; xml: 5,816; cpp: 2,400; yacc: 1,745; exp: 1,514; makefile: 1,019; pascal: 623; awk: 537; sql: 22
file content (52 lines) | stat: -rw-r--r-- 1,452 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--TEST--
Bug #51647 (Certificate file without private key (pk in another file) doesn't work)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
	include ("connect.inc");

	if (!is_object($link = mysqli_init()))
		printf("[001] Cannot create link\n");

	$path_to_pems = !$IS_MYSQLND? "ext/mysqli/tests/" : "";
	if (!$link->ssl_set("{$path_to_pems}client-key.pem", "{$path_to_pems}client-cert.pem", "{$path_to_pems}cacert.pem","",""))
		printf("[002] [%d] %s\n", $link->errno, $link->error);

	if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
		printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
	}

	if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
		if (1064 == $link->errno) {
			/* ERROR 1064 (42000): You have an error in your SQL syntax;  = sql strict mode */
			if ($res = $link->query("SHOW STATUS")) {
				while ($row = $res->fetch_assoc())
					if ($row['Variable_name'] == 'Ssl_cipher')
						break;
			} else {
				printf("[005] [%d] %s\n", $link->errno, $link->error);
			}
		} else {
			printf("[004] [%d] %s\n", $link->errno, $link->error);
		}
	} else {
		if (!$row = $res->fetch_assoc())
			printf("[006] [%d] %s\n", $link->errno, $link->error);
	}

	var_dump($row);

	print "done!";
?>
--EXPECTF--
array(2) {
  ["Variable_name"]=>
  string(10) "Ssl_cipher"
  ["Value"]=>
  string(%d) "%S"
}
done!