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