xref: /PHP-8.4/ext/mysqli/tests/bug51605.phpt (revision 73d68693)
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
13--FILE--
14<?php
15    include 'connect.inc';
16
17    $link = mysqli_init();
18    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
19        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
20    }
21    mysqli_close($link);
22    echo "closed once\n";
23
24    $link = mysqli_init();
25    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
26        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
27    }
28    mysqli_close($link);
29    echo "closed twice\n";
30
31    $link = mysqli_init();
32    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
33        printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
34    }
35    mysqli_close($link);
36    echo "closed for third time\n";
37
38    print "done!";
39?>
40--EXPECT--
41closed once
42closed twice
43closed for third time
44done!
45