xref: /PHP-8.4/ext/mysqli/tests/bug62046.phpt (revision a21edc52)
1--TEST--
2Bug #62046 	mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12
13    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
14        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
15    }
16    if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
17        printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
18    }
19    if (FALSE === $stmt->execute()) {
20        printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
21    }
22    if (FALSE === $stmt->store_result()) {
23        printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
24    }
25    $one = NULL;
26    if (FALSE === $stmt->bind_result($one)) {
27        printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
28    }
29    if (FALSE === $stmt->reset()) {
30        printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
31    }
32    while ($stmt->fetch()) {
33        var_dump($one);
34    }
35    $stmt->close();
36    $link->close();
37    echo "done!";
38?>
39--EXPECT--
40int(42)
41done!
42