xref: /PHP-8.1/ext/mysqli/tests/bug45289.phpt (revision b5a14e6c)
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        if ($IS_MYSQLND)
29            printf("[004] Can store result!\n");
30        else
31            printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
32    } else {
33        printf("[004] [%d] %s\n", $link->errno, $link->error);
34    }
35?>
36--CLEAN--
37<?php
38    require_once("clean_table.inc");
39?>
40--EXPECTF--
41[004] [%s
42