xref: /PHP-5.3/ext/date/tests/mktime-1.phpt (revision e6c1ff25)
1--TEST--
2Check for mktime with out-of-range parameters
3--INI--
4error_reporting=2047
5--FILE--
6<?php
7  date_default_timezone_set("Europe/Amsterdam");
8  # MacOS/X libc implementation doesn't treat out-of-range values
9  # the same way other unices do (Bug# 10686) so some extra code
10  # was added to datetime.c to take care of this
11	echo date("Y-m-d", mktime( 12, 0, 0, 3,  0, 2000)) ."\n";
12	echo date("Y-m-d", mktime( 12, 0, 0, 3, -1, 2000)) ."\n";
13	echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2000)) ."\n";
14	echo date("Y-m-d", mktime( 12, 0, 0, 3,  0, 2001)) ."\n";
15	echo date("Y-m-d", mktime( 12, 0, 0, 2, 29, 2001)) ."\n";
16	echo date("Y-m-d", mktime( 12, 0, 0, 0,  0, 2000)) ."\n";
17
18  putenv("TZ=Europe/London");
19  echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,-1))."\n";
20  echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,0))."\n";
21  echo date("Y-m-d H:i:s", mktime(12,0,0,3,+90,2000,1))."\n";
22  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,-1))."\n";
23  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,0))."\n";
24  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-90,2000,1))."\n";
25  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,-1))."\n";
26  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,0))."\n";
27  echo date("Y-m-d H:i:s", mktime(12,0,0,5,-1,2000,1))."\n";
28?>
29--EXPECT--
302000-02-29
312000-02-28
322000-02-29
332001-02-28
342001-03-01
351999-11-30
362000-05-29 12:00:00
372000-05-29 13:00:00
382000-05-29 12:00:00
392000-01-31 12:00:00
402000-01-31 12:00:00
412000-01-31 11:00:00
422000-04-29 12:00:00
432000-04-29 13:00:00
442000-04-29 12:00:00
45