xref: /PHP-7.2/ext/mysqli/tests/bug33263.phpt (revision f1d7e3ca)
1--TEST--
2Bug #33263 (mysqli_real_connect in __construct)
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11	require_once("connect.inc");
12
13	class test extends mysqli
14	{
15		public function __construct($host, $user, $passwd, $db, $port, $socket) {
16			parent::init();
17			parent::real_connect($host, $user, $passwd, $db, $port, $socket);
18		}
19	}
20
21	$mysql = new test($host, $user, $passwd, $db, $port, $socket);
22
23	$stmt = $mysql->prepare("SELECT DATABASE()");
24	$stmt->execute();
25	$stmt->bind_result($database);
26	$stmt->fetch();
27	$stmt->close();
28
29	if ($database != $db)
30		printf("[001] Expecting '%s' got %s/'%s'.\n",
31			gettype($database), $database);
32
33	$mysql->close();
34	print "done!";
35?>
36--EXPECTF--
37done!
38