Return to vsprintf_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test 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: 10: echo "*** 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 18: echo "\n-- Testing vsprintf() function with Zero arguments --\n"; 19: var_dump( vsprintf() ); 20: 21: echo "\n-- Testing vsprintf() function with less than expected no. of arguments --\n"; 22: var_dump( vsprintf($format) ); 23: 24: echo "\n-- testing vsprintf() function with more than expected no. of arguments --\n"; 25: var_dump( vsprintf($format, $args, $extra_arg) ); 26: 27: echo "Done"; 28: ?> 29: --EXPECTF-- 30: *** Testing vsprintf() : error conditions *** 31: 32: -- Testing vsprintf() function with Zero arguments -- 33: 34: Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d 35: bool(false) 36: 37: -- Testing vsprintf() function with less than expected no. of arguments -- 38: 39: Warning: Wrong parameter count for vsprintf() in %s on line %d 40: bool(false) 41: 42: -- testing vsprintf() function with more than expected no. of arguments -- 43: 44: Warning: Wrong parameter count for vsprintf() in %s on line %d 45: bool(false) 46: Done