xref: /PHP-8.0/ext/mysqli/tests/bug36420.phpt (revision 0c6d06ec)
1--TEST--
2Bug #36420 (segfault when access result->num_rows after calling result->close())
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10
11require_once("connect.inc");
12$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
13
14$result = $mysqli->query('select 1');
15
16$result->close();
17try {
18    $result->num_rows;
19} catch (Error $exception) {
20    echo $exception->getMessage() . "\n";
21}
22
23$mysqli->close();
24try {
25    $result->num_rows;
26} catch (Error $exception) {
27    echo $exception->getMessage() . "\n";
28}
29
30echo "Done\n";
31?>
32--EXPECT--
33mysqli_result object is already closed
34mysqli_result object is already closed
35Done
36