xref: /PHP-7.2/ext/date/tests/mktime_error.phpt (revision 17ccbeec)
1--TEST--
2Test mktime() function : error conditions
3--FILE--
4<?php
5/* Prototype  : int mktime  ([ int $hour= date("H")  [, int $minute= date("i")  [, int $second= date("s")  [, int $month= date("n")  [, int $day= date("j")  [, int $year= date("Y")  [, int $is_dst= -1  ]]]]]]] )
6 * Description: Get Unix timestamp for a date
7 * Source code: ext/date/php_date.c
8 * Alias to functions:
9 */
10error_reporting(E_ALL | E_STRICT);
11
12//Set the default time zone
13date_default_timezone_set("Europe/London");
14
15echo "*** Testing mktime() : error conditions ***\n";
16
17echo "\n-- Testing mktime() function with Zero arguments --\n";
18var_dump( mktime() );
19
20echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
21$hour = 10;
22$minute = 30;
23$sec = 45;
24$month = 7;
25$day = 2;
26$year = 1963;
27$extra_arg = 10;
28var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing mktime() : error conditions ***
34
35-- Testing mktime() function with Zero arguments --
36
37Deprecated: mktime(): You should be using the time() function instead in %s on line %d
38int(%d)
39
40-- Testing mktime() function with more than expected no. of arguments --
41
42Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d
43bool(false)
44===DONE===
45