mysql_free_result.phpt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. mysql_free_result()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifconnectfailure.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. include "connect.inc";
  11. $tmp = NULL;
  12. $link = NULL;
  13. if (!is_null($tmp = @mysql_free_result()))
  14. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  15. if (null !== ($tmp = @mysql_free_result($link)))
  16. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  17. require('table.inc');
  18. if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) {
  19. printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
  20. }
  21. var_dump(mysql_free_result($res));
  22. var_dump(mysql_free_result($res));
  23. if ($tmp = sys_get_temp_dir()) {
  24. $tmpname = tempnam($tmp, 'free_result');
  25. if ($fp = fopen($tmpname, 'w')) {
  26. if (false !== ($tmp = @mysql_free_result($fp)))
  27. printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
  28. fclose($fp);
  29. @unlink($tmpname);
  30. }
  31. }
  32. mysql_close($link);
  33. print "done!";
  34. ?>
  35. --CLEAN--
  36. <?php
  37. require_once("clean_table.inc");
  38. ?>
  39. --EXPECTF--
  40. Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
  41. bool(true)
  42. Warning: mysql_free_result(): %d is not a valid MySQL result resource in %s on line %d
  43. bool(false)
  44. done!