1--TEST-- 2mysqli_stmt_param_count() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 require('table.inc'); 14 15 if (!$stmt = mysqli_stmt_init($link)) 16 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 17 18 try { 19 mysqli_stmt_param_count($stmt); 20 } catch (Error $exception) { 21 echo $exception->getMessage() . "\n"; 22 } 23 24 function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) { 25 26 if (!mysqli_stmt_prepare($stmt, $query)) { 27 printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt)); 28 return false; 29 } 30 31 if ($expected !== ($tmp = mysqli_stmt_param_count($stmt))) 32 printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, 33 gettype($expected), $expected, 34 gettype($tmp), $tmp); 35 return true; 36 } 37 38 func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10); 39 func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20); 40 func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30); 41 func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40); 42 43 mysqli_stmt_close($stmt); 44 45 try { 46 mysqli_stmt_param_count($stmt); 47 } catch (Error $exception) { 48 echo $exception->getMessage() . "\n"; 49 } 50 51 mysqli_close($link); 52 53 print "done!"; 54?> 55--CLEAN-- 56<?php 57 require_once("clean_table.inc"); 58?> 59--EXPECT-- 60mysqli_stmt object is not fully initialized 61mysqli_stmt object is already closed 62done! 63