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