xref: /PHP-8.3/ext/mysqli/tests/062.phpt (revision 1451b9e6)
1--TEST--
2mysqli_result constructor
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11require_once 'connect.inc';
12
13$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
14
15$mysqli->real_query("SELECT 'foo' FROM DUAL");
16
17$myresult = new mysqli_result($mysqli);
18
19$row = $myresult->fetch_row();
20$myresult->close();
21$mysqli->close();
22
23var_dump($row);
24
25try {
26    new mysqli_result($mysqli);
27} catch (Error $exception) {
28    echo $exception->getMessage() . "\n";
29}
30
31$mysqli = new mysqli();
32try {
33    new mysqli_result($mysqli);
34} catch (Error $exception) {
35    echo $exception->getMessage() . "\n";
36}
37print "done!";
38?>
39--EXPECT--
40array(1) {
41  [0]=>
42  string(3) "foo"
43}
44my_mysqli object is already closed
45mysqli object is not fully initialized
46done!
47