xref: /PHP-8.1/ext/mysqli/tests/bug51605.phpt (revision b5a14e6c)
1--TEST--
2Bug #51605 Mysqli - zombie links
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--INI--
10mysqli.max_links = 1
11mysqli.allow_persistent = Off
12mysqli.max_persistent = 0
13mysqli.reconnect = Off
14--FILE--
15<?php
16    include ("connect.inc");
17
18    $link = mysqli_init();
19    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
20        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
21    }
22    mysqli_close($link);
23    echo "closed once\n";
24
25    $link = mysqli_init();
26    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
27        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
28    }
29    mysqli_close($link);
30    echo "closed twice\n";
31
32    $link = mysqli_init();
33    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
34        printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
35    }
36    mysqli_close($link);
37    echo "closed for third time\n";
38
39    print "done!";
40?>
41--EXPECT--
42closed once
43closed twice
44closed for third time
45done!
46