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--
38Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
39
40Warning: mysql_thread_id(): %d is not a valid MySQL-Link resource in %s on line %d
41done!
42