1--TEST-- 2Test localtime() function : error conditions 3--SKIPIF-- 4<?php 5if (!function_exists('strptime')) { 6 echo "SKIP strptime function not available in build"; 7} 8?> 9--FILE-- 10<?php 11/* Prototype : array strptime ( string $date , string $format ) 12 * Description: Parse a time/date generated with strftime() 13 * Source code: ext/standard/datetime.c 14 * Alias to functions: 15 */ 16 17//Set the default time zone 18date_default_timezone_set("Europe/London"); 19 20echo "*** Testing strptime() : error conditions ***\n"; 21 22echo "\n-- Testing strptime() function with Zero arguments --\n"; 23var_dump( strptime() ); 24 25echo "\n-- Testing strptime() function with less than expected no. of arguments --\n"; 26$format = '%b %d %Y %H:%M:%S'; 27$timestamp = mktime(8, 8, 8, 8, 8, 2008); 28$date = strftime($format, $timestamp); 29var_dump( strptime($date) ); 30 31echo "\n-- Testing strptime() function with more than expected no. of arguments --\n"; 32$extra_arg = 10; 33var_dump( strptime($date, $format, $extra_arg) ); 34 35?> 36===DONE=== 37--EXPECTF-- 38*** Testing strptime() : error conditions *** 39 40-- Testing strptime() function with Zero arguments -- 41 42Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d 43NULL 44 45-- Testing strptime() function with less than expected no. of arguments -- 46 47Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d 48NULL 49 50-- Testing strptime() function with more than expected no. of arguments -- 51 52Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d 53NULL 54===DONE=== 55 56