1--TEST--
2mysqli_thread_id()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13        printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14            $host, $user, $db, $port, $socket);
15        exit(1);
16    }
17
18    if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
19        printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
20            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
21
22    // should work if the thread id is correct
23    mysqli_kill($link, mysqli_thread_id($link));
24
25    mysqli_close($link);
26
27    try {
28        mysqli_thread_id($link);
29    } catch (Error $exception) {
30        echo $exception->getMessage() . "\n";
31    }
32
33    print "done!";
34?>
35--EXPECT--
36mysqli object is already closed
37done!
38