xref: /PHP-8.2/ext/mysqli/tests/bug55653.phpt (revision b5a14e6c)
1--TEST--
2Bug #55653 	PS crash with libmysql when binding same variable as param and out
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
17    $in_and_out = "a";
18
19    if (!($stmt = $link->stmt_init()))
20        printf("[002] [%d] %s\n", $link->errno, $link->error);
21
22    if (!($stmt->prepare("SELECT ?")) ||
23        !($stmt->bind_param("s", $in_and_out)) ||
24        !($stmt->execute()) ||
25        !($stmt->bind_result($in_and_out)))
26        printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
27
28    if (!$stmt->fetch())
29        printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
30
31    if ("a" !== $in_and_out)
32        printf("[005] Wrong result: '%s'\n", $in_and_out);
33
34    echo "done!";
35?>
36--EXPECT--
37done!
38