summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/071.phpt
blob: 6f45777978190993df168f158e259f27301479d6 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--TEST--
mysqli thread_id & kill
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
	require_once("connect.inc");

	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
	$version = $mysql->server_version;

	var_dump($mysql->ping());

	$ret = $mysql->kill($mysql->thread_id);
	if ($IS_MYSQLND) {
		if ($ret !== true){
			printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
		}
	} else {
		/* libmysql return value seems to depend on server version */
		if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
			/* TODO: find exact version */
			if ($ret !== true){
				printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
			}
		} else {
			if ($ret !== false){
				printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
			}
		}
	}

	var_dump($mysql->ping());

	$mysql->close();

	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);

	var_dump(mysqli_ping($mysql));

	$ret = $mysql->kill($mysql->thread_id);
	if ($IS_MYSQLND) {
		if ($ret !== true){
			printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
		}
	} else {
		/* libmysql return value seems to depend on server version */
		if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
			/* TODO: find exact version */
			if ($ret !== true){
				printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
			}
		} else {
			if ($ret !== false){
			printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
			}
		}
	}

	var_dump(mysqli_ping($mysql));

	$mysql->close();
	print "done!";
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
done!