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