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