1--TEST-- 2mysqli_free_result() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 require('table.inc'); 13 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 14 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 15 } 16 17 print "a\n"; 18 var_dump(mysqli_free_result($res)); 19 20 print "b\n"; 21 try { 22 mysqli_free_result($res); 23 } catch (Error $exception) { 24 echo $exception->getMessage() . "\n"; 25 } 26 27 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 28 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 29 } 30 31 print "c\n"; 32 var_dump(mysqli_store_result($link)); 33 var_dump(mysqli_error($link)); 34 print "[005]\n"; 35 36 mysqli_free_result($res); 37 38 if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { 39 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 40 } 41 print "d\n"; 42 var_dump(mysqli_use_result($link)); 43 var_dump(mysqli_error($link)); 44 print "[007]\n"; 45 var_dump(mysqli_free_result($res)); 46 47 mysqli_close($link); 48 print "done!"; 49?> 50--CLEAN-- 51<?php 52 require_once("clean_table.inc"); 53?> 54--EXPECT-- 55a 56NULL 57b 58mysqli_result object is already closed 59c 60bool(false) 61string(0) "" 62[005] 63d 64bool(false) 65string(0) "" 66[007] 67NULL 68done! 69