1--TEST--
2mysqli_fetch_lengths()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
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	if (!is_null($tmp = @mysqli_fetch_lengths()))
19		printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
20
21	if (!is_null($tmp = @mysqli_fetch_lengths($link)))
22		printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
23
24	require('table.inc');
25	if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
26		printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
27	}
28
29	var_dump(mysqli_fetch_lengths($res));
30	while ($row = mysqli_fetch_assoc($res))
31		var_dump(mysqli_fetch_lengths($res));
32	var_dump(mysqli_fetch_lengths($res));
33
34	mysqli_free_result($res);
35
36	var_dump(mysqli_fetch_lengths($res));
37
38	mysqli_close($link);
39	print "done!";
40?>
41--CLEAN--
42<?php
43	require_once("clean_table.inc");
44?>
45--EXPECTF--
46bool(false)
47array(2) {
48  [0]=>
49  int(1)
50  [1]=>
51  int(1)
52}
53bool(false)
54
55Warning: mysqli_fetch_lengths(): Couldn't fetch mysqli_result in %s on line %d
56NULL
57done!
58