xref: /PHP-5.3/ext/mysqli/tests/bug51605.phpt (revision 87bac04b)
1--TEST--
2Bug #51605 Mysqli - zombie links
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--INI--
9mysqli.max_links = 1
10mysqli.allow_persistent = Off
11mysqli.max_persistent = 0
12mysqli.reconnect = Off
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--EXPECTF--
41closed once
42closed twice
43closed for third time
44done!
45