1--TEST--
2mysqli_warning_count()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11    require_once("connect.inc");
12
13    require('table.inc');
14
15    if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
16        printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
17
18    if (0 !== ($tmp = mysqli_warning_count($link)))
19        printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
20
21    if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist"))
22        printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
23
24    if (1 !== ($tmp = mysqli_warning_count($link)))
25        printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
26
27    mysqli_close($link);
28
29    try {
30        mysqli_warning_count($link);
31    } catch (Error $exception) {
32        echo $exception->getMessage() . "\n";
33    }
34
35    print "done!";
36?>
37--CLEAN--
38<?php
39    require_once("clean_table.inc");
40?>
41--EXPECT--
42mysqli object is already closed
43done!
44