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