xref: /php-src/ext/date/tests/bug77243-002.phpt (revision b23dfe49)
1--TEST--
2Bug #77243 (Weekdays are calculated incorrectly for negative years)
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?>
5--FILE--
6<?php
7date_default_timezone_set('UTC');
8
9$startingPoints = [
10	-62167046400 - (((101 * 365) + 25) * 86400),
11	-62167046400 - (((100 * 365) + 25) * 86400),
12	-62167046400 - ((( 99 * 365) + 25) * 86400),
13];
14
15foreach ($startingPoints as $startingPoint)
16{
17	for ($i = -7; $i < 7; $i++ )
18	{
19		echo date('Y-m-d o-W-N', $startingPoint + ($i * 86400)), "\n";
20	}
21	echo "\n\n";
22}
23?>
24--EXPECT--
25-0102-12-26 -102-52-1
26-0102-12-27 -102-52-2
27-0102-12-28 -102-52-3
28-0102-12-29 -102-52-4
29-0102-12-30 -102-52-5
30-0102-12-31 -102-52-6
31-0101-01-01 -102-52-7
32-0101-01-02 -101-01-1
33-0101-01-03 -101-01-2
34-0101-01-04 -101-01-3
35-0101-01-05 -101-01-4
36-0101-01-06 -101-01-5
37-0101-01-07 -101-01-6
38-0101-01-08 -101-01-7
39
40
41-0101-12-26 -101-52-2
42-0101-12-27 -101-52-3
43-0101-12-28 -101-52-4
44-0101-12-29 -101-52-5
45-0101-12-30 -101-52-6
46-0101-12-31 -101-52-7
47-0100-01-01 -100-01-1
48-0100-01-02 -100-01-2
49-0100-01-03 -100-01-3
50-0100-01-04 -100-01-4
51-0100-01-05 -100-01-5
52-0100-01-06 -100-01-6
53-0100-01-07 -100-01-7
54-0100-01-08 -100-02-1
55
56
57-0100-12-26 -100-52-3
58-0100-12-27 -100-52-4
59-0100-12-28 -100-52-5
60-0100-12-29 -100-52-6
61-0100-12-30 -100-52-7
62-0100-12-31 -99-01-1
63-0099-01-01 -99-01-2
64-0099-01-02 -99-01-3
65-0099-01-03 -99-01-4
66-0099-01-04 -99-01-5
67-0099-01-05 -99-01-6
68-0099-01-06 -99-01-7
69-0099-01-07 -99-02-1
70-0099-01-08 -99-02-2
71