mysql_get_host_info.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. mysql_get_host_info()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifconnectfailure.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. include_once "connect.inc";
  11. if (NULL !== ($tmp = @mysql_get_host_info(NULL)))
  12. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  13. require "table.inc";
  14. if (!is_string($info = mysql_get_host_info($link)) || ('' === $info))
  15. printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
  16. $def_info = mysql_get_host_info();
  17. if ($def_info !== $info) {
  18. printf("[004] Host info for the default link and the specified link differ, [%d] %s\n",
  19. mysql_errno(), mysql_error());
  20. var_dump($def_info);
  21. var_dump($info);
  22. }
  23. if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($info)) {
  24. printf("[005] Expecting Unicode error message!\n");
  25. var_inspect($info);
  26. }
  27. if (!is_null($tmp = @mysql_get_host_info($link, "too many arguments"))) {
  28. printf("[006] Expecting NULL/NULL got %s/%s\n", $tmp, gettype($tmp));
  29. }
  30. print "done!";
  31. ?>
  32. --CLEAN--
  33. <?php
  34. require_once("clean_table.inc");
  35. ?>
  36. --EXPECTF--
  37. 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
  38. done!