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    $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
24
25    if (false !== ($tmp = $mysqli->prepare(false)))
26        printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
27    printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
28
29    if (false !== ($tmp = $mysqli->prepare('')))
30        printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
31    printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
32
33    print "done!";
34?>
35--CLEAN--
36<?php
37require_once 'clean_table.inc';
38?>
39--EXPECT--
40a) [1065] Query was empty
41b) [1065] Query was empty
42c) [1065] Query was empty
43c) [1065] Query was empty
44done!
45