xref: /PHP-8.2/ext/mysqli/tests/bug45289.phpt (revision 62d393b1)
1--TEST--
2Bug #45289 (Bogus store_result on PS)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11    require('table.inc');
12
13    $link->close();
14
15    $link = mysqli_init();
16    if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket)))
17        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
18            $host, $user, $db, $port, $socket);
19
20    $id = 1;
21    if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1')))
22        printf("[002] [%d] %s\n", $link->errno, $link->error);
23
24    if (!$stmt->bind_param('i', $id) || !$stmt->execute())
25        printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
26
27    if ($res = $link->store_result()) {
28        printf("[004] Can store result!\n");
29    } else {
30        printf("[004] [%d] %s\n", $link->errno, $link->error);
31    }
32?>
33--CLEAN--
34<?php
35    require_once("clean_table.inc");
36?>
37--EXPECTF--
38[004] [%s
39