xref: /PHP-8.4/ext/date/tests/bug33414-1.phpt (revision bd1d2c7b)
1--TEST--
2Bug #33414 [1] (Comprehensive list of incorrect days returned after strotime() / date() tests)
3--INI--
4date.timezone=America/Mendoza
5--FILE--
6<?php
7
8print "TZ=America/Mendoza - wrong day.\n";
9$tStamp = mktime (17, 17, 17, 1, 8327, 1970);
10print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
11$strtotime_tstamp = strtotime("next Sunday", $tStamp);
12print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
13print "wanted=Sunday              00:00:00\n\n";
14
15print "TZ=America/Catamarca - wrong day.\n";
16date_default_timezone_set("America/Catamarca");
17$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
18print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
19$strtotime_tstamp = strtotime("next Sunday", $tStamp);
20print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
21print "wanted=Sunday              00:00:00\n\n";
22
23print "TZ=America/Cordoba - wrong day.\n";
24date_default_timezone_set("America/Cordoba");
25$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
26print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
27$strtotime_tstamp = strtotime("next Sunday", $tStamp);
28print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
29print "wanted=Sunday              00:00:00\n\n";
30
31print "TZ=America/Rosario - wrong day.\n";
32date_default_timezone_set("America/Rosario");
33$tStamp = mktime (17, 17, 17, 1, 7958, 1970);
34print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
35$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
36print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
37print "wanted=Tuesday           00:00:00\n\n";
38
39print "TZ=Europe/Vienna - wrong day - giving unexpected results, at
40least on my system :-)\n";
41date_default_timezone_set("Europe/Vienna");
42$tStamp = mktime (17, 17, 17, 1, 3746, 1970);
43print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
44$strtotime_tstamp = strtotime("next Thursday", $tStamp);
45print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
46print "wanted=Thursday             00:00:00\n\n";
47
48print "TZ=Asia/Baku - wrong day.\n";
49date_default_timezone_set("Asia/Baku");
50$tStamp = mktime (17, 17, 17, 1, 8299, 1970);
51print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
52$strtotime_tstamp = strtotime("second Monday", $tStamp);
53print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
54print "wanted=Monday              00:00:00\n\n";
55
56print "TZ=America/Noronha - wrong day.\n";
57date_default_timezone_set("America/Noronha");
58$tStamp = mktime (17, 17, 17, 1, 10866, 1970);
59print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
60$strtotime_tstamp = strtotime("next Friday", $tStamp);
61print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
62print "wanted=Friday              00:00:00\n\n";
63
64print "TZ=America/Havana - wrong day.\n";
65date_default_timezone_set("America/Havana");
66$tStamp = mktime (17, 17, 17, 1, 12720, 1970);
67print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
68$strtotime_tstamp = strtotime("next Thursday", $tStamp);
69print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
70print "wanted=Thursday             00:00:00\n\n";
71
72print "TZ=Europe/Tallinn - wrong day.\n";
73date_default_timezone_set("Europe/Tallinn");
74$tStamp = mktime (17, 17, 17, 1, 11777, 1970);
75print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
76$strtotime_tstamp = strtotime("next Saturday", $tStamp);
77print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
78print "wanted=Saturday          00:00:00\n\n";
79
80print "TZ=Asia/Jerusalem - wrong day.\n";
81date_default_timezone_set("Asia/Jerusalem");
82$tStamp = mktime (17, 17, 17, 1, 13056, 1970);
83print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
84$strtotime_tstamp = strtotime("next Thursday", $tStamp);
85print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
86print "wanted=Thursday             00:00:00\n\n";
87
88print "TZ=Europe/Vilnius - wrong day.\n";
89date_default_timezone_set("Europe/Vilnius");
90$tStamp = mktime (17, 17, 17, 1, 12140, 1970);
91print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
92$strtotime_tstamp = strtotime("next Friday", $tStamp);
93print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
94print "wanted=Friday            00:00:00\n\n";
95
96print "TZ=Pacific/Kwajalein - wrong day.\n";
97date_default_timezone_set("Pacific/Kwajalein");
98$tStamp = mktime (17, 17, 17, 1, 8627, 1970);
99print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
100$strtotime_tstamp = strtotime("next Saturday", $tStamp);
101print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
102print "wanted=Sunday            00:00:00\n\n";
103
104print "TZ=Asia/Ulan_Bator - wrong day.\n";
105date_default_timezone_set("Asia/Ulan_Bator");
106$tStamp = mktime (17, 17, 17, 1, 11588, 1970);
107print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
108$strtotime_tstamp = strtotime("next Saturday", $tStamp);
109print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
110print "wanted=Saturday            00:00:00\n\n";
111
112print "TZ=America/Cancun - wrong day.\n";
113date_default_timezone_set("America/Cancun");
114$tStamp = mktime (17, 17, 17, 1, 11785, 1970);
115print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
116$strtotime_tstamp = strtotime("next Sunday", $tStamp);
117print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
118print "wanted=Sunday            00:00:00\n\n";
119
120print "TZ=America/Mexico_City - wrong day.\n";
121date_default_timezone_set("America/Mexico_City");
122$tStamp = mktime (17, 17, 17, 1, 11781, 1970);
123print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
124$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
125print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
126print "wanted=Wednesday            00:00:00\n\n";
127
128print "TZ=America/Mazatlan - wrong day.\n";
129date_default_timezone_set("America/Mazatlan");
130$tStamp = mktime (17, 17, 17, 1, 11780, 1970);
131print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
132$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
133print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
134print "wanted=Tuesday            00:00:00\n\n";
135
136print "TZ=America/Chihuahua - wrong day.\n";
137date_default_timezone_set("America/Chihuahua");
138$tStamp = mktime (17, 17, 17, 1, 11782, 1970);
139print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
140$strtotime_tstamp = strtotime("next Thursday", $tStamp);
141print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
142print "wanted=Thursday            00:00:00\n\n";
143
144print "TZ=Asia/Kuala_Lumpur - wrong day.\n";
145date_default_timezone_set("Asia/Kuala_Lumpur");
146$tStamp = mktime (17, 17, 17, 1, 4380, 1970);
147print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
148$strtotime_tstamp = strtotime("next Monday", $tStamp);
149print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
150print "wanted=Monday            00:00:00\n\n";
151
152print "TZ=Pacific/Chatham - wrong day.\n";
153date_default_timezone_set("Pacific/Chatham");
154$tStamp = mktime (17, 17, 17, 1, 1762, 1970);
155print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
156$strtotime_tstamp = strtotime("next Monday", $tStamp);
157print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
158print "wanted=Monday            00:00:00\n\n";
159
160print "TZ=America/Lima - wrong day.\n";
161date_default_timezone_set("America/Lima");
162$tStamp = mktime (17, 17, 17, 1, 5839, 1970);
163print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
164$strtotime_tstamp = strtotime("next Thursday", $tStamp);
165print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
166print "wanted=Thursday            00:00:00\n\n";
167
168print "TZ=Asia/Karachi - wrong day.\n";
169date_default_timezone_set("Asia/Karachi");
170$tStamp = mktime (17, 17, 17, 1, 11783, 1970);
171print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
172$strtotime_tstamp = strtotime("next Friday", $tStamp);
173print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
174print "wanted=Friday            00:00:00\n\n";
175
176print "TZ=America/Asuncion - wrong day.\n";
177date_default_timezone_set("America/Asuncion");
178$tStamp = mktime (17, 17, 17, 1, 11746, 1970);
179print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
180$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
181print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
182print "wanted=Wednesday            00:00:00\n\n";
183
184print "TZ=Asia/Singapore - wrong day.\n";
185date_default_timezone_set("Asia/Singapore");
186$tStamp = mktime (17, 17, 17, 1, 4383, 1970);
187print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
188$strtotime_tstamp = strtotime("next Thursday", $tStamp);
189print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
190print "wanted=Thursday             00:00:00\n\n";
191
192print "TZ=America/Montevideo - wrong day.\n";
193date_default_timezone_set("America/Montevideo");
194$tStamp = mktime (17, 17, 17, 1, 12678, 1970);
195print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
196$strtotime_tstamp = strtotime("next Thursday", $tStamp);
197print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
198print "wanted=Thursday             00:00:00\n\n";
199
200?>
201--EXPECT--
202TZ=America/Mendoza - wrong day.
203tStamp=Sunday 1992-10-18 17:17:17 -02 1
204result=Sunday 1992-10-25 00:00:00 -02 1
205wanted=Sunday              00:00:00
206
207TZ=America/Catamarca - wrong day.
208tStamp=Sunday 1990-10-21 17:17:17 -02 1
209result=Sunday 1990-10-28 00:00:00 -02 1
210wanted=Sunday              00:00:00
211
212TZ=America/Cordoba - wrong day.
213tStamp=Sunday 1990-10-21 17:17:17 -02 1
214result=Sunday 1990-10-28 00:00:00 -02 1
215wanted=Sunday              00:00:00
216
217TZ=America/Rosario - wrong day.
218tStamp=Tuesday 1991-10-15 17:17:17 -04 0
219result=Tuesday 1991-10-22 00:00:00 -02 1
220wanted=Tuesday           00:00:00
221
222TZ=Europe/Vienna - wrong day - giving unexpected results, at
223least on my system :-)
224tStamp=Thursday 1980-04-03 17:17:17 CET 0
225result=Thursday 1980-04-10 00:00:00 CEST 1
226wanted=Thursday             00:00:00
227
228TZ=Asia/Baku - wrong day.
229tStamp=Sunday 1992-09-20 17:17:17 +04 1
230result=Monday 1992-09-28 00:00:00 +04 0
231wanted=Monday              00:00:00
232
233TZ=America/Noronha - wrong day.
234tStamp=Friday 1999-10-01 17:17:17 -02 0
235result=Friday 1999-10-08 00:00:00 -01 1
236wanted=Friday              00:00:00
237
238TZ=America/Havana - wrong day.
239tStamp=Thursday 2004-10-28 17:17:17 CDT 1
240result=Thursday 2004-11-04 00:00:00 CDT 1
241wanted=Thursday             00:00:00
242
243TZ=Europe/Tallinn - wrong day.
244tStamp=Saturday 2002-03-30 17:17:17 EET 0
245result=Saturday 2002-04-06 00:00:00 EEST 1
246wanted=Saturday          00:00:00
247
248TZ=Asia/Jerusalem - wrong day.
249tStamp=Thursday 2005-09-29 17:17:17 IDT 1
250result=Thursday 2005-10-06 00:00:00 IDT 1
251wanted=Thursday             00:00:00
252
253TZ=Europe/Vilnius - wrong day.
254tStamp=Friday 2003-03-28 17:17:17 EET 0
255result=Friday 2003-04-04 00:00:00 EEST 1
256wanted=Friday            00:00:00
257
258TZ=Pacific/Kwajalein - wrong day.
259tStamp=Saturday 1993-08-14 17:17:17 -12 0
260result=Sunday 1993-08-22 00:00:00 +12 0
261wanted=Sunday            00:00:00
262
263TZ=Asia/Ulan_Bator - wrong day.
264tStamp=Saturday 2001-09-22 17:17:17 +09 1
265result=Saturday 2001-09-29 00:00:00 +09 1
266wanted=Saturday            00:00:00
267
268TZ=America/Cancun - wrong day.
269tStamp=Sunday 2002-04-07 17:17:17 CDT 1
270result=Sunday 2002-04-14 00:00:00 CDT 1
271wanted=Sunday            00:00:00
272
273TZ=America/Mexico_City - wrong day.
274tStamp=Wednesday 2002-04-03 17:17:17 CST 0
275result=Wednesday 2002-04-10 00:00:00 CDT 1
276wanted=Wednesday            00:00:00
277
278TZ=America/Mazatlan - wrong day.
279tStamp=Tuesday 2002-04-02 17:17:17 MST 0
280result=Tuesday 2002-04-09 00:00:00 MDT 1
281wanted=Tuesday            00:00:00
282
283TZ=America/Chihuahua - wrong day.
284tStamp=Thursday 2002-04-04 17:17:17 MST 0
285result=Thursday 2002-04-11 00:00:00 MDT 1
286wanted=Thursday            00:00:00
287
288TZ=Asia/Kuala_Lumpur - wrong day.
289tStamp=Monday 1981-12-28 17:17:17 +0730 0
290result=Monday 1982-01-04 00:00:00 +08 0
291wanted=Monday            00:00:00
292
293TZ=Pacific/Chatham - wrong day.
294tStamp=Monday 1974-10-28 17:17:17 +1245 0
295result=Monday 1974-11-04 00:00:00 +1345 1
296wanted=Monday            00:00:00
297
298TZ=America/Lima - wrong day.
299tStamp=Thursday 1985-12-26 17:17:17 -05 0
300result=Thursday 1986-01-02 00:00:00 -04 1
301wanted=Thursday            00:00:00
302
303TZ=Asia/Karachi - wrong day.
304tStamp=Friday 2002-04-05 17:17:17 PKT 0
305result=Friday 2002-04-12 00:00:00 PKST 1
306wanted=Friday            00:00:00
307
308TZ=America/Asuncion - wrong day.
309tStamp=Wednesday 2002-02-27 17:17:17 -03 1
310result=Wednesday 2002-03-06 00:00:00 -03 1
311wanted=Wednesday            00:00:00
312
313TZ=Asia/Singapore - wrong day.
314tStamp=Thursday 1981-12-31 17:17:17 +0730 0
315result=Thursday 1982-01-07 00:00:00 +08 0
316wanted=Thursday             00:00:00
317
318TZ=America/Montevideo - wrong day.
319tStamp=Thursday 2004-09-16 17:17:17 -03 0
320result=Thursday 2004-09-23 00:00:00 -02 1
321wanted=Thursday             00:00:00
322