xref: /PHP-8.1/ext/mysqli/tests/bug66043.phpt (revision b5a14e6c)
1--TEST--
2Bug #66043 (Segfault calling bind_param() on mysqli)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11require 'connect.inc';
12if (!$db = 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
16if (!$db->query("DROP TABLE IF EXISTS test")) {
17    printf("[002] [%d] %s\n", mysqli_errno($db), mysqli_error($db));
18    die();
19}
20
21if (!$db->query("CREATE TABLE test(str TEXT)")) {
22    printf("[003] [%d] %s\n", mysqli_errno($db), mysqli_error($db));
23    die();
24}
25
26if (!$db->query("INSERT INTO test(str) VALUES ('Test')")) {
27    printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
28    die();
29}
30
31$stmt = $db->stmt_init();
32if (!$stmt->prepare("SELECT str FROM test")) {
33    printf("[004] [%d] %s\n", mysqli_errno($db), mysqli_error($db));
34    die();
35}
36
37$stmt->execute();
38$stmt->bind_result($testArg);
39echo "Okey";
40?>
41--CLEAN--
42<?php
43require_once("clean_table.inc");
44?>
45--EXPECT--
46Okey
47