1--TEST--
2mysqli_thread_id()
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	$tmp    = NULL;
14	$link   = NULL;
15
16	if (!is_null($tmp = @mysqli_thread_id()))
17		printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
18
19	if (!is_null($tmp = @mysqli_thread_id($link)))
20		printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
21
22	require('table.inc');
23
24	if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
25		printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
26			gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
27
28	// should work if the thread id is correct
29	mysqli_kill($link, mysqli_thread_id($link));
30
31	mysqli_close($link);
32
33	if (NULL !== ($tmp = mysqli_thread_id($link)))
34		printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
35
36	print "done!";
37?>
38--CLEAN--
39<?php
40	require_once("clean_table.inc");
41?>
42--EXPECTF--
43Warning: mysqli_thread_id(): Couldn't fetch mysqli in %s on line %d
44done!