1--TEST-- 2mysqli_stmt_init() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 /* 12 NOTE: no datatype tests here! This is done by 13 mysqli_stmt_bind_result.phpt already. Restrict 14 this test case to the basics. 15 */ 16 require_once("connect.inc"); 17 18 $tmp = NULL; 19 $link = NULL; 20 21 if (!is_null($tmp = @mysqli_stmt_init())) 22 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 23 24 if (!is_null($tmp = @mysqli_stmt_init($link))) 25 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 26 27 require('table.inc'); 28 29 if (!is_object($stmt = mysqli_stmt_init($link))) 30 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 31 32 if (!is_object($stmt2 = @mysqli_stmt_init($link))) 33 printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 34 35 mysqli_stmt_close($stmt); 36 37 if (NULL !== ($tmp = mysqli_stmt_init($stmt))) 38 printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 39 40 mysqli_close($link); 41 42 if (NULL !== ($tmp = mysqli_stmt_init($link))) 43 printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 44 45 print "done!"; 46?> 47--CLEAN-- 48<?php 49 require_once("clean_table.inc"); 50?> 51--EXPECTF-- 52Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt 53 in %s on line %d 54 55Warning: mysqli_stmt_init() expects parameter 1 to be mysqli, object given in %s on line %d 56 57Warning: mysqli_stmt_init(): Couldn't fetch mysqli in %s on line %d 58done! 59