xref: /PHP-8.2/ext/mysqli/tests/bug50772.phpt (revision b5a14e6c)
1--TEST--
2Bug #50772 (mysqli constructor without parameters does not return a working mysqli object)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11    include "connect.inc";
12    $db1 = new mysqli();
13
14    // These calls fail
15    $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
16    my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket);
17    if(mysqli_connect_error()) {
18        echo "error 1\n";
19    } else {
20        echo "ok 1\n";
21    }
22
23    $db2 = mysqli_init();
24
25    $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
26    my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket);
27    if(mysqli_connect_error()) {
28        echo "error 2\n";
29    } else {
30        echo "ok 2\n";
31    }
32    echo "done\n";
33?>
34--EXPECT--
35ok 1
36ok 2
37done
38