ID: 20382 Comment by: nickj-phpbugs at nickj dot org Reported By: nickj-phpbugs at nickj dot org Status: Feedback Bug Type: Date/time related Operating System: * PHP Version: 4CVS, 5CVS New Comment:
How's this for a short and simple test script? Applies strtotime() to every day between 1970 and 2037, and gives a list of everything that looks wrong. ====================================================== <?php $request_day = "Monday"; for ($i=1; ; $i++) { // start at year 1970, bail out at year 2038 $tStamp = mktime (17,17,17,1,$i,1970); if (date("Y", $tStamp) == 2038) break; // request a day, check what we got, complain if differs $strtotime_timestamp = strtotime ($request_day, $tStamp); $result_day = date("l", $strtotime_timestamp); if ($result_day != $request_day) print "strtotime wrong on: " . date("j-M-Y", $tStamp) . " - gave a $result_day, not a $request_day.\n"; } ?> Previous Comments: ------------------------------------------------------------------------ [2004-04-08 07:00:17] [EMAIL PROTECTED] I'm pretty sure the script is buggy. Please give us a test case for ONE date that is wrong, and comment your code properly too. ------------------------------------------------------------------------ [2004-04-08 04:25:55] [EMAIL PROTECTED] Can you please give a simpler test? (I somehow have a feeling your script is buggy, not PHP) ------------------------------------------------------------------------ [2004-04-08 01:39:23] nickj-phpbugs at nickj dot org It appears that this problem has not been resolved. I've downloaded the latest Stable Win32 package snapshot from http://snaps.php.net/ , in particular this one: http://snaps.php.net/win32/php4-win32-STABLE-200404080430.zip [I.e. from roughly 5 after this bug was closed] Then I've run the test script on it from an above comment. This produces the following results: ========================================================== I:\new downloads\just downloaded\php4-win32-STABLE-200404080430>php bug-20382-test.php Content-type: text/html X-Powered-By: PHP/4.3.6RC3-dev Discrepancy for 2002-3-26 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2002-3-27 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2002-3-28 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2002-3-29 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2002-3-30 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2002-3-31 - results were 2002-3-31 vs 2002-4-1 Discrepancy for 2003-3-25 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2003-3-26 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2003-3-27 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2003-3-28 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2003-3-29 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2003-3-30 - results were 2003-3-30 vs 2003-3-31 Discrepancy for 2004-3-23 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2004-3-24 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2004-3-25 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2004-3-26 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2004-3-27 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2004-3-28 - results were 2004-3-28 vs 2004-3-29 Discrepancy for 2005-3-22 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2005-3-23 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2005-3-24 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2005-3-25 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2005-3-26 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2005-3-27 - results were 2005-3-27 vs 2005-3-28 Discrepancy for 2006-3-21 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2006-3-22 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2006-3-23 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2006-3-24 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2006-3-25 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2006-3-26 - results were 2006-3-26 vs 2006-3-27 Discrepancy for 2007-3-20 - results were 2007-3-25 vs 2007-3-26 Discrepancy for 2007-3-21 - results were 2007-3-25 vs 2007-3-26 Discrepancy for 2007-3-22 - results were 2007-3-25 vs 2007-3-26 Discrepancy for 2007-3-23 - results were 2007-3-25 vs 2007-3-26 Discrepancy for 2007-3-24 - results were 2007-3-25 vs 2007-3-26 Discrepancy for 2007-3-25 - results were 2007-3-25 vs 2007-3-26 PHP version: 4.3.6RC3-dev<br> ========================================================== What I would expect to happen is that there would not be any discrepancies. The fact there are discrepancies indicates to me that this problem is still unresolved. I understand that there have been two date-related problems solved recently (#27719 and #27780), but whatever updates were made for those problems do not appear to have fixed this problem. ------------------------------------------------------------------------ [2004-04-03 09:10:33] [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. ------------------------------------------------------------------------ [2003-04-06 18:47:03] scottmacvicar at ntlworld dot com This is a DST problem by the looks of it. The specific dates mentioned are when DST takes effect which is the last sunday in March. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/20382 -- Edit this bug report at http://bugs.php.net/?id=20382&edit=1