1--TEST-- 2mysqli_free_result() 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 $db = 'test'; 14 $tmp = NULL; 15 $link = NULL; 16 17 if (!is_null($tmp = @mysqli_free_result())) 18 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 19 20 if (!is_null($tmp = @mysqli_free_result($link))) 21 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 22 23 require('table.inc'); 24 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 25 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 26 } 27 28 print "a\n"; 29 var_dump(mysqli_free_result($res)); 30 print "b\n"; 31 var_dump(mysqli_free_result($res)); 32 33 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 34 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 35 } 36 print "c\n"; 37 var_dump($res = mysqli_store_result($link)); 38 var_dump(mysqli_error($link)); 39 print "[005]\n"; 40 var_dump(mysqli_free_result($res)); 41 42 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 43 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 44 } 45 print "d\n"; 46 var_dump($res = mysqli_use_result($link)); 47 var_dump(mysqli_error($link)); 48 print "[007]\n"; 49 var_dump(mysqli_free_result($res)); 50 51 mysqli_close($link); 52 print "done!"; 53?> 54--CLEAN-- 55<?php 56 require_once("clean_table.inc"); 57?> 58--EXPECTF-- 59a 60NULL 61b 62 63Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d 64NULL 65c 66bool(false) 67%s(0) "" 68[005] 69 70Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in %s on line %d 71NULL 72d 73bool(false) 74%s(0) "" 75[007] 76 77Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in %s on line %d 78NULL 79done!