xref: /PHP-8.2/ext/mysqli/tests/bug33263.phpt (revision 625b89af)
1--TEST--
2Bug #33263 (mysqli_real_connect in __construct)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
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::__construct();
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--EXPECT--
37done!
38