bug51242.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Bug #51242 (Empty mysql.default_port does not default to 3306 anymore, but 0)
  3. --INI--
  4. mysql.default_port=
  5. mysql.default_socket=/this/does/not/really/need/to/exist
  6. --SKIPIF--
  7. <?php
  8. require_once('skipif.inc');
  9. require_once('skipifnotmysqlnd.inc');
  10. // Specific to this bug: we need to be able to connect via TCP. We'll use
  11. // 127.0.0.1:3306 as a (hopefully) moderately sensible default if the hostname
  12. // is actually specified as localhost.
  13. if ($host == 'localhost') {
  14. $host = '127.0.0.1';
  15. }
  16. if (!@mysql_connect("$host:3306", $user, $passwd)) {
  17. die("skip mysql not available at $host:3306");
  18. }
  19. ?>
  20. --FILE--
  21. <?php
  22. require_once('connect.inc');
  23. if ($host == 'localhost') {
  24. $host = '127.0.0.1';
  25. }
  26. if ($link = my_mysql_connect($host, $user, $passwd, $db, null, $socket)) {
  27. var_dump($link);
  28. } else {
  29. printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  30. $host, $user, $db, null, $socket);
  31. }
  32. ?>
  33. --EXPECTF--
  34. 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
  35. resource(%d) of type (mysql link)