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