xref: /PHP-8.1/ext/mysqli/tests/bug72701.phpt (revision b5a14e6c)
1--TEST--
2Bug #72701 mysqli_get_host_info() wrong output
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8require_once("connect.inc");
9
10if ("127.0.0.1" != $host && "localhost" != $host) {
11    die("skip require 127.0.0.1 connection");
12}
13
14?>
15--FILE--
16<?php
17
18require_once("connect.inc");
19
20$con = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
21
22if (mysqli_connect_errno()) {
23    echo "Failed to connect to MySQL: " . mysqli_connect_error();
24}
25
26var_dump(preg_match(",(127.0.0.1|localhost) via .*,i", mysqli_get_host_info($con)));
27
28mysqli_close($con);
29?>
30--EXPECT--
31int(1)
32