#33414 [Asn-Csd]: Comprehensive list of incorrect days returned after strtotime() / date() tests

2005-10-07 Thread derick
 ID:   33414
 Updated by:   [EMAIL PROTECTED]
 Reported By:  nickj-phpbugs at nickj dot org
-Status:   Assigned
+Status:   Closed
 Bug Type: Date/time related
 Operating System: Debian Woody GNU/Linux 3.0r6
 PHP Version:  5CVS-2005-06-22 (dev)
 Assigned To:  derick
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Those three are correct, the mentioned days simply don't exist as at
this time the zones switched from -11 to +13 or similar:

[EMAIL PROTECTED]:~$ zdump -v Pacific/Kwajalein
Pacific/Kwajalein  Fri Aug 20 11:59:59 1993 UTC = Thu Aug 19 23:59:59
1993 MHT isdst=0 gmtoff=-43200
Pacific/Kwajalein  Fri Aug 20 12:00:00 1993 UTC = Sat Aug 21 00:00:00
1993 MHT isdst=0 gmtoff=43200

[EMAIL PROTECTED]:~$ zdump -v Pacific/Enderbury
Pacific/Enderbury  Sun Jan  1 10:59:59 1995 UTC = Sat Dec 31 23:59:59
1994 PHOT isdst=0 gmtoff=-39600
Pacific/Enderbury  Sun Jan  1 11:00:00 1995 UTC = Mon Jan  2 00:00:00
1995 PHOT isdst=0 gmtoff=46800

[EMAIL PROTECTED]:~$ zdump -v Pacific/Kiritimati
Pacific/Kiritimati  Sun Jan  1 09:59:59 1995 UTC = Sat Dec 31 23:59:59
1994 LINT isdst=0 gmtoff=-36000
Pacific/Kiritimati  Sun Jan  1 10:00:00 1995 UTC = Mon Jan  2 00:00:00
1995 LINT isdst=0 gmtoff=50400



Previous Comments:


[2005-09-05 08:38:35] nickj-phpbugs at nickj dot org

Looking very good but I'm still showing just a handful that are giving
the wrong days, namely:

===
ludo:~/tmp/php-5.1-dev# cat my-bugs/bug33414/win32-wrong-days.php
?php 

$tz=Pacific/Kwajalein;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8261, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Friday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Friday00:00:00\n\n;

$tz=Pacific/Enderbury;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Sunday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Sunday00:00:00\n\n;

$tz=Pacific/Kiritimati;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Sunday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Sunday00:00:00\n\n;

?
===

Output with the 5.1.x-dev CVS snapshot from 200509050430 on a Linux
system:
===
ludo:~/tmp/php-5.1-dev# php5-200509050430/sapi/cli/php
my-bugs/bug33414/win32-wrong-days.php
TZ=Pacific/Kwajalein
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday00:00:00

TZ=Pacific/Enderbury
tStamp=Sunday 1994-12-25 17:17:17 PHOT 0
result=Monday 1995-01-02 00:00:00 PHOT 0
wanted=Sunday00:00:00

TZ=Pacific/Kiritimati
tStamp=Sunday 1994-12-25 17:17:17 LINT 0
result=Monday 1995-01-02 00:00:00 LINT 0
wanted=Sunday00:00:00

ludo:~/tmp/php-5.1-dev# 
===



[2005-09-01 14:42:49] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.





[2005-07-06 06:14:20] nickj-phpbugs at nickj dot org

Most of the test cases are fixed in php5-200507060230 (including the 3
possible regressions listed above from bug #20382).

Just the following 3 seem to be giving incorrect results now (found
after doing another exhaustive check on a win32 system, and confirming
the results are also incorrect on a Linux system):

?php 

$tz=Pacific/Kwajalein;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8261, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Friday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Friday00:00:00\n\n;

$tz=Pacific/Enderbury;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Sunday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print 

#33414 [Asn-Csd]: Comprehensive list of incorrect days returned after strtotime() / date() tests

2005-09-01 Thread derick
 ID:   33414
 Updated by:   [EMAIL PROTECTED]
 Reported By:  nickj-phpbugs at nickj dot org
-Status:   Assigned
+Status:   Closed
 Bug Type: Date/time related
 Operating System: Debian Woody GNU/Linux 3.0r6
 PHP Version:  5CVS-2005-06-22 (dev)
 Assigned To:  derick
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2005-07-06 06:14:20] nickj-phpbugs at nickj dot org

Most of the test cases are fixed in php5-200507060230 (including the 3
possible regressions listed above from bug #20382).

Just the following 3 seem to be giving incorrect results now (found
after doing another exhaustive check on a win32 system, and confirming
the results are also incorrect on a Linux system):

?php 

$tz=Pacific/Kwajalein;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8261, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Friday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Friday00:00:00\n\n;

$tz=Pacific/Enderbury;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Sunday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Sunday00:00:00\n\n;

$tz=Pacific/Kiritimati;
print TZ=$tz\n;
putenv(TZ=$tz);
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
print tStamp=. date(l Y-m-d H:i:s T I, $tStamp). \n;
$strtotime_tstamp = strtotime(Sunday, $tStamp);
print result=.date(l Y-m-d H:i:s T I, $strtotime_tstamp).\n;
print wanted=Sunday00:00:00\n\n;

?

Output is:
===
ludo:~/tmp/php-5.1-dev# php5-200507060230/sapi/cli/php
bug33414/win32-wrong-days.php 
TZ=Pacific/Kwajalein
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday00:00:00

TZ=Pacific/Enderbury
tStamp=Sunday 1994-12-25 17:17:17 PHOT 0
result=Monday 1995-01-02 00:00:00 PHOT 0
wanted=Sunday00:00:00

TZ=Pacific/Kiritimati
tStamp=Sunday 1994-12-25 17:17:17 LINT 0
result=Monday 1995-01-02 00:00:00 LINT 0
wanted=Sunday00:00:00

ludo:~/tmp/php-5.1-dev#
===



[2005-06-22 11:06:31] nickj-phpbugs at nickj dot org

Sorry, one further update - I think it would be better if my test
script printed out the exact expected results, rather than just testing
for the correct day. The reason that I say this is that I am seeing a
possible regression of bug #20382, not just for the Vienna timezone,
but for 2 other timezones as well. I.e. when I run these commands:

./get-and-build-php-5.1-dev 200506220830
cd php5-200506220830
# Run the date-related tests:
TEST_PHP_EXECUTABLE=sapi/cli/php sapi/cli/php run-tests.php
../bug33414/bug33414.phpt ext/date/tests/*.phpt
# Can then see the output of bug20382-2 with:
diff -u ext/date/tests/bug20382-2.exp ext/date/tests/bug20382-2.out

Then the diff shows this:
==
ludo:~/tmp/php-5.1-dev/php5-200506220830# # Can then see the output of
bug20382-2 with:
ludo:~/tmp/php-5.1-dev/php5-200506220830# diff -u
ext/date/tests/bug20382-2.exp ext/date/tests/bug20382-2.out
--- ext/date/tests/bug20382-2.exp   Wed Jun 22 18:58:14 2005
+++ ext/date/tests/bug20382-2.out   Wed Jun 22 18:58:14 2005
@@ -105,17 +105,17 @@
 
 America/Buenos_Aires
 ts = Monday 1974-09-30 17:17:17 ART
-result = Monday 1974-10-07 00:00:00 ART
+result = Monday 1974-10-07 01:00:00 ARST
 wanted = Monday00:00:00
 
 America/Rosario
 ts = Monday 1974-09-30 17:17:17 ART
-result = Monday 1974-10-07 00:00:00 ART
+result = Monday 1974-10-07 01:00:00 ARST
 wanted = Monday00:00:00
 
 Europe/Vienna
 ts = Monday 1980-03-31 17:17:17 CET
-result = Monday 1980-04-07 00:00:00 CEST
+result = Sunday 1980-04-06 23:00:00 CET
 wanted = Monday00:00:00
 
 Asia/Baku
ludo:~/tmp/php-5.1-dev/php5-200506220830# 
==

I.e. Either not getting the expected results in America/Buenos_Aires
and America/Rosario, as well as Vienna, or the --EXPECT-- portion of
the test is wrong.



[2005-06-22 09:32:57] nickj-phpbugs at nickj dot org

Also available as a .phpt unit-test here:
http://home.swiftdsl.com.au/~npj/php-bugs/bug33414.phpt

(Note: first attempt at a .phpt, so please forgive me if it's not quite
right).