1--TEST--
2mysql_thread_id()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10include_once "connect.inc";
11
12$tmp    = NULL;
13$link   = NULL;
14
15if (!is_null($tmp = @mysql_thread_id($link)))
16	printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
17
18require('table.inc');
19
20if (!is_int($id = mysql_thread_id($link)) || (0 === $id))
21	printf("[002] Expecting int/any but zero, got %s/%s. [%d] %s\n",
22		gettype($id), $id, mysql_errno($link), mysql_error($link));
23
24if (!is_int($id_def = mysql_thread_id()) || (0 === $id_def))
25	printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
26		gettype($id_def), $id_def, mysql_errno(), mysql_error());
27
28assert($id === $id_def);
29
30mysql_close($link);
31
32if (false !== ($tmp = mysql_thread_id($link)))
33	printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
34
35print "done!";
36?>
37--EXPECTF--
38Warning: mysql_thread_id(): %d is not a valid MySQL-Link resource in %s on line %d
39done!