1--TEST--
2mysqli_connect_error()
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	// too many parameter
17	if (!is_null($tmp = @mysqli_connect_error($link)))
18		printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
19
20	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
21		printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
22			$host, $user, $db, $port, $socket);
23
24	if (NULL !== ($tmp = mysqli_connect_error()))
25		printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
26
27	mysqli_close($link);
28
29	if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
30		printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
31			$host, $user . 'unknown_really', $db, $port, $socket);
32
33	if ('' === ($tmp = mysqli_connect_error()))
34		printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp);
35
36	print "done!";
37?>
38--EXPECTF--
39done!