1--TEST--
2mysqli_fetch_lengths()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11
12    if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14            $host, $user, $db, $port, $socket);
15    }
16
17    require('table.inc');
18    if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
19        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
20    }
21
22    var_dump(mysqli_fetch_lengths($res));
23    while ($row = mysqli_fetch_assoc($res))
24        var_dump(mysqli_fetch_lengths($res));
25    var_dump(mysqli_fetch_lengths($res));
26
27    mysqli_free_result($res);
28
29    try {
30        mysqli_fetch_lengths($res);
31    } catch (Error $exception) {
32        echo $exception->getMessage() . "\n";
33    }
34
35    mysqli_close($link);
36    print "done!";
37?>
38--CLEAN--
39<?php
40    require_once("clean_table.inc");
41?>
42--EXPECT--
43bool(false)
44array(2) {
45  [0]=>
46  int(1)
47  [1]=>
48  int(1)
49}
50bool(false)
51mysqli_result object is already closed
52done!
53