php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63391 [PATCH] Incorrect/inconsistent day of week prior to the year 1600
Submitted: 2012-10-30 01:44 UTC Modified: 2013-11-27 17:18 UTC
From: tcarter at noggin dot com dot au Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.4.8 OS: Linux (x86_64)
Private report: No CVE-ID: None
 [2012-10-30 01:44 UTC] tcarter at noggin dot com dot au
Description:
------------
PHP timelib calculates the day of the week incorrectly for dates prior to the 1st of January 1600.


Test script:
---------------
<?php

  ini_set('date.timezone', 'UTC');

  print "Date         PHP   OS\n";
  print "----------   ---   ---\n";
  $dates = array('1599-12-30', '1599-12-31', '1600-01-01', '1600-01-02');
  foreach ($dates as $date) {
    print strftime(
      "%Y-%m-%d   %a   ",
       strtotime($date)
    ) . `env TZ=UTC date --date=$date +%a`;
   }
?>


Expected result:
----------------
Date         PHP   OS
----------   ---   ---
1599-12-30   Thu   Thu
1599-12-31   Fri   Fri
1600-01-01   Sat   Sat
1600-01-02   Sun   Sun

Actual result:
--------------
Date         PHP   OS
----------   ---   ---
1599-12-30   Fri   Thu
1599-12-31   Sat   Fri
1600-01-01   Sat   Sat
1600-01-02   Sun   Sun


Patches

pre_1600_day_of_week_fix (last revision 2013-11-28 06:21 UTC by tcarter at noggin dot com dot au)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-27 17:18 UTC] derick@php.net
-Status: Open +Status: Feedback
 [2013-11-27 17:18 UTC] derick@php.net
Your subject seems to have [PATCH] in it, but I can't see where you have that patch. Could you attach it here or provide a link?
 [2013-11-28 06:23 UTC] tcarter at noggin dot com dot au
Sorry, forgot to attach the patch, uploaded now.
I've tested this (against the linux date command) for every day from the year 0000 to the year 2050
 [2013-11-28 09:35 UTC] tcarter at noggin dot com dot au
I'm pretty sure https://bugs.php.net/bug.php?id=61599 is the same bug too.
 [2013-11-28 16:34 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2013-11-28 16:34 UTC] derick@php.net
-Status: Feedback +Status: Closed
 [2013-11-28 16:34 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2013-11-28 16:34 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2013-11-28 16:34 UTC] derick@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2013-11-28 16:49 UTC] ab@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2014-10-07 23:16 UTC] stas@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec
Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Oct 09 08:01:27 2024 UTC