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