1--TEST--
2mysqli_stmt_init()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    /*
12    NOTE: no datatype tests here! This is done by
13    mysqli_stmt_bind_result.phpt already. Restrict
14    this test case to the basics.
15    */
16    require_once 'connect.inc';
17    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
18        printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
19            $host, $user, $db, $port, $socket);
20        exit(1);
21    }
22
23    if (!is_object($stmt = mysqli_stmt_init($link)))
24        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
25
26    if (!is_object($stmt2 = @mysqli_stmt_init($link)))
27        printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
28
29    try {
30        mysqli_stmt_close($stmt);
31    } catch (Error $exception) {
32        echo $exception->getMessage() . "\n";
33    }
34
35    mysqli_close($link);
36
37    try {
38        mysqli_stmt_init($link);
39    } catch (Error $exception) {
40        echo $exception->getMessage() . "\n";
41    }
42
43    print "done!";
44?>
45--EXPECT--
46mysqli_stmt object is not fully initialized
47mysqli object is already closed
48done!
49