xref: /PHP-8.0/ext/mysqli/tests/mysqli_close.phpt (revision e3e67b72)
1--TEST--
2mysqli_close()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11
12    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
13        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14            $host, $user, $db, $port, $socket);
15
16    $tmp = mysqli_close($link);
17    if (true !== $tmp)
18        printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
19
20    try {
21        mysqli_query($link, "SELECT 1");
22    } catch (Error $exception) {
23        echo $exception->getMessage() . "\n";
24    }
25
26    print "done!";
27?>
28--EXPECT--
29mysqli object is already closed
30done!
31