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