mysql_close.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. mysql_close()
  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 (false !== ($tmp = @mysql_close()))
  14. printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
  15. if (NULL !== ($tmp = @mysql_close($link, $link)))
  16. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  17. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
  18. printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  19. $host, $user, $db, $port, $socket);
  20. $tmp = @mysql_close(NULL);
  21. if (null !== $tmp)
  22. printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  23. $tmp = mysql_close($link);
  24. if (true !== $tmp)
  25. printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
  26. if (false !== ($tmp = @mysql_query("SELECT 1", $link)))
  27. printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
  28. print "done!\n";
  29. ?>
  30. --EXPECTF--
  31. 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
  32. done!