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