xref: /PHP-5.5/ext/date/tests/bug27719.phpt (revision e753493c)
1--TEST--
2Bug #27719 (mktime returns incorrect timestamp for dst days)
3--INI--
4date.timezone=EST
5error_reporting=2047
6--FILE--
7<?php /* $Id$ */
8	$a = mktime(0, 0, 0, 4, 4, 2004, 0);
9	$b = mktime(0, 0, 0, 4, 4, 2004, 1);
10	$c = mktime(0, 0, 0, 4, 4, 2004, -1);
11	echo "$a ".date("m/d/y h:i:s\n",$a);
12	echo "$b ".date("m/d/y h:i:s\n",$b);
13	echo "$c ".date("m/d/y h:i:s\n",$c);
14	echo "\n";
15	date_default_timezone_set('EST5EDT');  // DST not in effect
16	$a = mktime(0, 0, 0, 2, 4, 2004, 0);
17	$b = mktime(0, 0, 0, 2, 4, 2004, 1);
18	$c = mktime(0, 0, 0, 2, 4, 2004, -1);
19	echo "$a ".date("m/d/y h:i:s\n",$a);
20	echo "$b ".date("m/d/y h:i:s\n",$b);
21	echo "$c ".date("m/d/y h:i:s\n",$c);
22	echo "\n";
23	date_default_timezone_set('EST5EDT');
24	$a = mktime(0, 0, 0, 4, 4, 2004, 0);
25	$b = mktime(0, 0, 0, 4, 4, 2004, 1);
26	$c = mktime(0, 0, 0, 4, 4, 2004, -1);
27	echo "$a ".date("m/d/y h:i:s\n",$a);
28	echo "$b ".date("m/d/y h:i:s\n",$b);
29	echo "$c ".date("m/d/y h:i:s\n",$c);
30	echo "\n";
31	date_default_timezone_set('EST5EDT');
32	$a = mktime(3, 0, 0, 4, 4, 2004, 0);
33	$b = mktime(3, 0, 0, 4, 4, 2004, 1);
34	$c = mktime(3, 0, 0, 4, 4, 2004, -1);
35	echo "$a ".date("m/d/y h:i:s\n",$a);
36	echo "$b ".date("m/d/y h:i:s\n",$b);
37	echo "$c ".date("m/d/y h:i:s\n",$c);
38	echo "\n";
39	date_default_timezone_set('EST5EDT');
40	$a = mktime(0, 0, 0, 6, 4, 2004, 0);
41	$b = mktime(0, 0, 0, 6, 4, 2004, 1);
42	$c = mktime(0, 0, 0, 6, 4, 2004, -1);
43	echo "$a ".date("m/d/y h:i:s\n",$a);
44	echo "$b ".date("m/d/y h:i:s\n",$b);
45	echo "$c ".date("m/d/y h:i:s\n",$c);
46	echo "\n";
47?>
48--EXPECTF--
491081054800 04/04/04 12:00:00
50%s
511081054800 04/04/04 12:00:00
52
531075870800 02/04/04 12:00:00
541075867200 02/03/04 11:00:00
551075870800 02/04/04 12:00:00
56
571081054800 04/04/04 12:00:00
581081051200 04/03/04 11:00:00
591081054800 04/04/04 12:00:00
60
611081065600 04/04/04 04:00:00
621081062000 04/04/04 03:00:00
631081062000 04/04/04 03:00:00
64
651086325200 06/04/04 01:00:00
661086321600 06/04/04 12:00:00
671086321600 06/04/04 12:00:00
68