1--TEST--
2mysqli_get_cache_stats() - disabled via php.ini
3--INI--
4mysqlnd.collect_statistics="0"
5mysqlnd.collect_memory_statistics="0"
6--SKIPIF--
7<?PHP
8require_once('skipif.inc');
9require_once('skipifemb.inc');
10require_once('skipifconnectfailure.inc');
11if (!function_exists('mysqli_get_cache_stats')) {
12	die("skip only available with mysqlnd");
13}
14?>
15--FILE--
16<?php
17	$before = mysqli_get_cache_stats();
18	/*
19	NOTE: the function belongs to the mysqnd zval cache. The
20	mysqlnd zval cache was part of PHP from PHP 5.3.0(-dev) to
21	PHP 5.3.0RC3 or something. And it was turned off by default.
22	The function never returned anything meaningful in any released version of PHP.
23	*/
24	if (!is_array($before)) {
25		printf("[001] Expecting array, got %s.\n", gettype($before));
26		var_dump($before);
27	}
28
29	require_once('table.inc');
30	if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
31		printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
32	}
33	while ($row = mysqli_fetch_assoc($res))
34		;
35	if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
36		printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
37	}
38	while ($row = mysqli_fetch_assoc($res))
39		;
40
41	$after = mysqli_get_cache_stats();
42        if ($before !== $after) {
43		printf("[002] Statistics have changed\n");
44		var_dump($before);
45		var_dump($after);
46	}
47	mysqli_close($link);
48
49	print "done!";
50?>
51--CLEAN--
52<?php
53	require_once("clean_table.inc");
54?>
55--EXPECTF--
56done!
57