1--TEST--
2mysqli_stmt_bind_param()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifemb.inc');
7require_once('skipifconnectfailure.inc');
8?>
9--FILE--
10<?php
11	/*
12	The way we test the INSERT and data types overlaps with
13	the mysqli_stmt_bind_result test in large parts. There is only
14	one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
15	fetch the inserted values. This way we test
16	mysqli_query()/mysqli_fetch_assoc() for all possible data types
17	in this file and we test mysqli_stmt_bind_result() in the other
18	test -- therefore the "duplicate" makes some sense to me.
19	*/
20	require_once("connect.inc");
21
22	$tmp    = NULL;
23	$link   = NULL;
24
25	if (!is_null($tmp = @mysqli_stmt_bind_param()))
26		printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
27
28	if (!is_null($tmp = @mysqli_stmt_bind_param($link)))
29		printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
30
31	if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link)))
32		printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
33
34	require('table.inc');
35
36	$stmt = mysqli_stmt_init($link);
37	if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
38		printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
39
40	$id = null;
41	$label = null;
42
43	/*
44	libmysql gives a less descriptive error message but mysqlnd,
45	we did not unify the error messages but ignore this slight difference silently
46	*/
47	if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
48		printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
49
50	if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
51		printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
52
53	/* TODO: somehwhat undocumented syntax! */
54	$param = array($id);
55	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
56		printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
57
58	$param = array($id, $label, $id);
59	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
60		printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
61
62	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id)))
63		printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
64
65	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label)))
66		printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
67
68	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label)))
69		printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
70
71	if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label)))
72		printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
73
74	if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
75		printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
76
77	if (function_exists("memory_get_usage")) {
78		$mem = memory_get_usage();
79		for ($i = 0; $i < 20000; $i++) {
80			if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
81				printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
82		}
83		if (($tmp = (memory_get_usage() - $mem)) > 600)
84			printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp);
85	}
86
87	$id = 100;
88	$label = "z";
89	if (!mysqli_stmt_execute($stmt))
90		printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
91
92	mysqli_stmt_close($stmt);
93
94	if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id)))
95		printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
96	$row = mysqli_fetch_assoc($res);
97	if (($row['id'] != $id) || ($row['label'] != $label))
98		printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']);
99	mysqli_free_result($res);
100
101	function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) {
102
103		if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
104			printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
105			return false;
106		}
107
108		if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
109			// don't bail - it might be that the server does not support the data type
110			return false;
111		}
112
113		if (!$stmt = mysqli_stmt_init($link)) {
114			printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
115			return false;
116		}
117
118		if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) {
119			printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
120			return false;
121		}
122
123		$id = 1;
124		if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
125			printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
126			return false;
127		}
128
129		if (!mysqli_stmt_execute($stmt)) {
130			printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
131			return false;
132		}
133		mysqli_stmt_close($stmt);
134
135		if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
136			printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
137			return false;
138		}
139
140		if (!$row = mysqli_fetch_assoc($res)) {
141			printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
142			return false;
143		}
144
145		if ($alternative) {
146			if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) {
147				printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n",
148					$offset + 6, $bind_type, $sql_type,
149					$id, $bind_value, gettype($bind_value), $row['id'], $row['label']);
150				return false;
151			}
152		} else {
153			if (($row['id'] != $id) || ($row['label'] != $bind_value)) {
154				printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n",
155					$offset + 6, $bind_type, $sql_type,
156					$id, $bind_value, $row['id'], $row['label']);
157				return false;
158			}
159		}
160
161		mysqli_free_result($res);
162		return true;
163	}
164
165	function func_mysqli_stmt_bind_make_string($len) {
166
167		$ret = '';
168		for ($i = 0; $i < $len; $i++)
169			$ret .= chr(mt_rand(65, 90));
170
171		return $ret;
172	}
173
174	func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20);
175	func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30);
176	func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40);
177	func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50);
178
179	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60);
180	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70);
181	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80);
182	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90);
183
184	func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100);
185	func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110);
186	func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120);
187	func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130);
188	func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140);
189
190	func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150);
191	func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160);
192	func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170);
193	func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180);
194	func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190);
195
196	func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200);
197	func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210);
198	func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220);
199	func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230);
200	func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240);
201	func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250);
202
203	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260);
204	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270);
205	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280);
206	func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290);
207
208	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900);
209	// ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910);
210	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920);
211
212/*
213	??
214	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300);
215	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320);
216	*/
217	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310);
218	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330);
219	if (2147483647 == PHP_INT_MAX) {
220		func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09');
221		func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09');
222	}
223	func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18');
224	func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19');
225	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950);
226	func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960);
227
228	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350);
229	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370);
230	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
231	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
232
233	/*
234	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
235	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
236		*/
237	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380);
238	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390);
239	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400);
240	func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410);
241
242	// don't care about date() strict TZ warnings...
243	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420);
244	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430);
245	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440);
246
247	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450);
248	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460);
249	func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470);
250
251	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480);
252
253	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490);
254	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500);
255	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510);
256
257	func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520);
258	func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530);
259	func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540);
260
261	$string255 = func_mysqli_stmt_bind_make_string(255);
262	func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550);
263	func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560);
264	func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570);
265	func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580);
266
267	$string65k = func_mysqli_stmt_bind_make_string(65535);
268	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590);
269	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600);
270	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610);
271	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620);
272	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630);
273
274	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640);
275	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650);
276	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660);
277	func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670);
278
279	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680);
280	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690);
281	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700);
282	func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710);
283
284	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720);
285	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730);
286	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740);
287	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750);
288
289	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760);
290	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770);
291	func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780);
292
293	// Note: you cannot insert any blob values this way. But you can check the API at least partly this way
294	// Extra BLOB tests are in mysqli_stmt_send_long()
295	func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790);
296	func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800);
297	func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810);
298	func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820);
299	func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830);
300	func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840);
301
302	func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850);
303	func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860);
304	func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870);
305	func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880);
306
307	if (mysqli_get_server_version($link) >= 50600)
308		func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34");
309
310	$stmt = mysqli_stmt_init($link);
311	if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
312		printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
313
314	$id = null;
315	$label = null;
316	if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
317		printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
318
319	mysqli_stmt_execute($stmt);
320
321	if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
322		printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
323
324	mysqli_stmt_close($stmt);
325	include("table.inc");
326
327	if (!$stmt = mysqli_stmt_init($link))
328		printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
329
330	if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
331		printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
332
333	$id = $label = null;
334	if (true !== ($tmp = $stmt->bind_param('is', $id, $label)))
335		printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n",
336			gettype($tmp), $tmp,
337			$stmt->errno, $stmt->error);
338
339	$id = 100; $label = 'z';
340	if (!$stmt->execute())
341		printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error);
342
343	if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
344		printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
345
346	if (!$row = mysqli_fetch_assoc($res))
347		printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
348
349	if ($row['id'] != 100  || $row['label'] != 'z') {
350		printf("[2009] Row seems wrong, dumping record\n");
351		var_dump($row);
352	}
353	mysqli_free_result($res);
354
355	$value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
356	if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
357		printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
358
359        foreach ($value_list as $k => $values) {
360		if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) {
361			printf("[2011] bind_param() failed for id = %d, [%d] %s\n",
362				$values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
363			continue;
364		}
365		if (!$stmt->execute())
366			printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n",
367				$values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
368
369		if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id'])))
370			printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
371		if (!$row = mysqli_fetch_assoc($res))
372			printf("[2014] Cannot find row id = %d\n", $values['id']);
373		else if (isset($row['label']) && ($values['label'] != $row['label']))
374			printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']);
375
376		mysqli_free_result($res);
377	}
378
379	mysqli_stmt_close($stmt);
380	mysqli_close($link);
381
382	/* Check that the function alias exists. It's a deprecated function,
383	but we have not announce the removal so far, therefore we need to check for it */
384	if (!is_null($tmp = @mysqli_stmt_bind_param()))
385			printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
386	print "done!";
387?>
388--CLEAN--
389<?php
390	require_once("clean_table.inc");
391?>
392--EXPECTF--
393Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in %s on line %d
394
395Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in %s on line %d
396
397Warning: mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in %s on line %d
398
399Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in %s on line %d
400
401Warning: mysqli_stmt_bind_param(): Undefined fieldtype a (parameter 3) in %s on line %d
402
403Warning: mysqli_stmt_bind_param(): Undefined fieldtype a (parameter 4) in %s on line %d
404done!
405