1--TEST--
2Testing mysqli.max_links
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--INI--
10mysqli.max_links=1
11--FILE--
12<?php
13    require_once 'connect.inc';
14    require_once 'table.inc';
15
16    // to make sure we have at least one working connection...
17    var_dump($link->query('DO 1'));
18    // to make sure that max_links is really set to one
19    var_dump((int)ini_get('mysqli.max_links'));
20
21    $links = array();
22    for ($i = 1; $i <= 5; $i++)
23        if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
24            printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n",
25                $i, mysqli_connect_errno(), mysqli_connect_error(),
26                mysqli_errno($links[$i]), mysqli_error($links[$i]));
27
28    mysqli_close($link);
29    print "done!";
30?>
31--CLEAN--
32<?php
33	require_once 'clean_table.inc';
34?>
35--EXPECTF--
36bool(true)
37int(1)
38
39Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
40
41Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
42
43Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
44
45Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
46
47Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
48done!
49