summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/bug50772.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/tests/bug50772.phpt')
-rw-r--r--ext/mysqli/tests/bug50772.phpt36
1 files changed, 36 insertions, 0 deletions
diff --git a/ext/mysqli/tests/bug50772.phpt b/ext/mysqli/tests/bug50772.phpt
new file mode 100644
index 0000000000..4724d0f29e
--- /dev/null
+++ b/ext/mysqli/tests/bug50772.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #50772 (mysqli constructor without parameters does not return a working mysqli object)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+ include "connect.inc";
+ $db1 = new mysqli();
+
+ // These calls fail
+ $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ $db1->real_connect($host, $user, $passwd);
+ if(mysqli_connect_error()) {
+ echo "error 1\n";
+ } else {
+ echo "ok 1\n";
+ }
+
+ $db2 = mysqli_init();
+
+ $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ $db2->real_connect($host, $user, $passwd);
+ if(mysqli_connect_error()) {
+ echo "error 2\n";
+ } else {
+ echo "ok 2\n";
+ }
+ echo "done\n";
+?>
+--EXPECTF--
+ok 1
+ok 2
+done \ No newline at end of file