1--TEST-- 2Test vsprintf() function : error conditions 3--FILE-- 4<?php 5/* Prototype : string vsprintf(string $format , array $args) 6 * Description: Return a formatted string 7 * Source code: ext/standard/formatted_print.c 8 */ 9 10echo "*** Testing vsprintf() : error conditions ***\n"; 11 12// initialising the required variables 13$format = "%s"; 14$args = array("hello"); 15$extra_arg = "extra arg"; 16 17// Zero arguments 18echo "\n-- Testing vsprintf() function with Zero arguments --\n"; 19var_dump( vsprintf() ); 20 21echo "\n-- Testing vsprintf() function with less than expected no. of arguments --\n"; 22var_dump( vsprintf($format) ); 23 24echo "\n-- testing vsprintf() function with more than expected no. of arguments --\n"; 25var_dump( vsprintf($format, $args, $extra_arg) ); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing vsprintf() : error conditions *** 31 32-- Testing vsprintf() function with Zero arguments -- 33 34Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d 35bool(false) 36 37-- Testing vsprintf() function with less than expected no. of arguments -- 38 39Warning: Wrong parameter count for vsprintf() in %s on line %d 40bool(false) 41 42-- testing vsprintf() function with more than expected no. of arguments -- 43 44Warning: Wrong parameter count for vsprintf() in %s on line %d 45bool(false) 46Done 47