1--TEST--
2mysqli_get_client_stats() - implicit_free_result
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?PHP
7require_once 'skipifconnectfailure.inc';
8?>
9--INI--
10mysqlnd.collect_statistics=1
11mysqlnd.collect_memory_statistics=1
12--FILE--
13<?php
14    require_once 'connect.inc';
15    require_once 'table.inc';
16
17    $stats = mysqli_get_client_stats();
18    printf("BEGINNING: implicit_free_result = %d\n",	$stats['implicit_free_result']);
19
20    if (!$res = mysqli_query($link, 'SELECT id FROM test'))
21        printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
22
23    mysqli_free_result($res);
24    mysqli_close($link);
25
26    $after = mysqli_get_client_stats();
27    if ($after['implicit_free_result'] != $stats['implicit_free_result'])
28        printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n",
29            $after['implicit_free_result'] - $stats['implicit_free_result']);
30
31    $stats = $after;
32    printf("END: implicit_free_result = %d\n",	$stats['implicit_free_result']);
33
34    print "done!";
35?>
36--CLEAN--
37<?php
38	require_once 'clean_table.inc';
39?>
40--EXPECTF--
41BEGINNING: implicit_free_result = %d
42END: implicit_free_result = %d
43done!
44