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