Skip to content

Commit 30dcff2

Browse files
committed
add test to connect using host:port
1 parent 5488876 commit 30dcff2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
mysqli_connect() with port in host
3+
--EXTENSIONS--
4+
mysqli
5+
--SKIPIF--
6+
<?php
7+
require_once 'skipifconnectfailure.inc';
8+
?>
9+
--FILE--
10+
<?php
11+
require_once 'connect.inc';
12+
13+
// using port / host arguments
14+
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
15+
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
16+
$host, $user, $db, $port, $socket);
17+
}
18+
19+
mysqli_close($link);
20+
21+
// using port in host
22+
if (!$link = mysqli_connect("$host:$port", $user, $passwd, $db, "1$port", $socket)) {
23+
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
24+
"$host:$port", $user, $db, "1$port", $socket);
25+
}
26+
27+
mysqli_close($link);
28+
?>
29+
Done
30+
--EXPECTF--
31+
Done

0 commit comments

Comments
 (0)