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