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
35echo "\n-- Testing strptime() function on failure --\n";
36var_dump( strptime('foo', $format) );
37
38?>
39===DONE===
40--EXPECTF--
41*** Testing strptime() : error conditions ***
42
43-- Testing strptime() function with Zero arguments --
44
45Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d
46NULL
47
48-- Testing strptime() function with less than expected no. of arguments --
49
50Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d
51NULL
52
53-- Testing strptime() function with more than expected no. of arguments --
54
55Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
56NULL
57
58-- Testing strptime() function on failure --
59bool(false)
60===DONE===
61