1--TEST--
2mysqli_prepare() - no object on failure
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require('table.inc');
11
12    if (false !== ($tmp = mysqli_prepare($link, false)))
13        printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
14    printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
15
16    if (false !== ($tmp = mysqli_prepare($link, '')))
17        printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
18    printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
19
20    mysqli_close($link);
21
22    if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
23        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
24            $host, $user, $db, $port, $socket);
25
26    if (false !== ($tmp = $mysqli->prepare(false)))
27        printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
28    printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
29
30    if (false !== ($tmp = $mysqli->prepare('')))
31        printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
32    printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
33
34    print "done!";
35?>
36--CLEAN--
37<?php
38require_once("clean_table.inc");
39?>
40--EXPECT--
41a) [1065] Query was empty
42b) [1065] Query was empty
43c) [1065] Query was empty
44c) [1065] Query was empty
45done!
46