xref: /PHP-7.1/ext/mysqli/tests/bug55653.phpt (revision 113213f0)
1--TEST--
2Bug #55653 	PS crash with libmysql when binding same variable as param and out
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10	require_once("connect.inc");
11
12	if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
13		printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
14	}
15
16	$in_and_out = "a";
17
18	if (!($stmt = $link->stmt_init()))
19		printf("[002] [%d] %s\n", $link->errno, $link->error);
20
21	if (!($stmt->prepare("SELECT ?")) ||
22		!($stmt->bind_param("s", $in_and_out)) ||
23		!($stmt->execute()) ||
24		!($stmt->bind_result($in_and_out)))
25		printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
26
27	if (!$stmt->fetch())
28		printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
29
30	if ("a" !== $in_and_out)
31		printf("[005] Wrong result: '%s'\n", $in_and_out);
32
33	echo "done!";
34?>
35--EXPECT--
36done!
37