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