xref: /PHP-7.2/ext/mysqli/tests/071.phpt (revision f1d7e3ca)
1--TEST--
2mysqli thread_id & kill
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11	require_once("connect.inc");
12
13	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
14	$version = $mysql->server_version;
15
16	var_dump($mysql->ping());
17
18	$ret = $mysql->kill($mysql->thread_id);
19	if ($IS_MYSQLND) {
20		if ($ret !== true){
21			printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
22		}
23	} else {
24		/* libmysql return value seems to depend on server version */
25		if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
26			/* TODO: find exact version */
27			if ($ret !== true){
28				printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
29			}
30		} else {
31			if ($ret !== false){
32				printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
33			}
34		}
35	}
36
37	var_dump($mysql->ping());
38
39	$mysql->close();
40
41	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
42
43	var_dump(mysqli_ping($mysql));
44
45	$ret = $mysql->kill($mysql->thread_id);
46	if ($IS_MYSQLND) {
47		if ($ret !== true){
48			printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
49		}
50	} else {
51		/* libmysql return value seems to depend on server version */
52		if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
53			/* TODO: find exact version */
54			if ($ret !== true){
55				printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
56			}
57		} else {
58			if ($ret !== false){
59			printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
60			}
61		}
62	}
63
64	var_dump(mysqli_ping($mysql));
65
66	$mysql->close();
67	print "done!";
68?>
69--EXPECT--
70bool(true)
71bool(false)
72bool(true)
73bool(false)
74done!
75