1--TEST-- 2mysqli_warning_count() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 $tmp = NULL; 14 $link = NULL; 15 16 if (!is_null($tmp = @mysqli_warning_count())) 17 printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 18 19 if (!is_null($tmp = @mysqli_warning_count($link))) 20 printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 21 22 require('table.inc'); 23 24 if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many"))) 25 printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 26 27 if (!$res = mysqli_query($link, "SELECT id, label FROM test")) 28 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 29 30 if (0 !== ($tmp = mysqli_warning_count($link))) 31 printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp); 32 33 if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist")) 34 printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 35 36 if (1 !== ($tmp = mysqli_warning_count($link))) 37 printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp); 38 39 mysqli_close($link); 40 41 if (NULL !== ($tmp = mysqli_warning_count($link))) 42 printf("[010] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 43 44 print "done!"; 45?> 46--CLEAN-- 47<?php 48 require_once("clean_table.inc"); 49?> 50--EXPECTF-- 51Warning: mysqli_warning_count(): Couldn't fetch mysqli in %s on line %d 52done!