php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28275 mktime() b0rked for 4-4-YYYY
Submitted: 2004-05-04 19:07 UTC Modified: 2004-05-04 19:30 UTC
From: escot001 at student dot ucr dot edu Assigned:
Status: Not a bug Package: Calendar related
PHP Version: 4.3.5 OS: FreeBSD 4.9-STABLE
Private report: No CVE-ID: None
 [2004-05-04 19:07 UTC] escot001 at student dot ucr dot edu
Description:
------------
When feeding mktime() the parameters 4 for month, 4 for date, and any year, the begining of the UNIX epoch is returned.

Reproduce code:
---------------
<?php

$d = 00;
$m = 00;

$y = 2010;  // can be any date, i assume - tested 2003, 2004, 2010


while ($m < 13) {
   $m++;
   while ($d < 32) {
      $d++;
      $cur_date = date("m-d-Y", mktime(0,0,0,$m,$d,$y));
      echo $cur_date;
      echo ("<br>");
   }
   $d = 00;
}
?>


Expected result:
----------------
03-22-2010
03-23-2010
03-24-2010
03-25-2010
03-26-2010
03-27-2010
03-28-2010
03-29-2010
03-30-2010
03-31-2010
04-01-2010
04-01-2010
04-02-2010
04-03-2010
04-04-2010
04-05-2010
04-06-2010
04-07-2010
04-08-2010
04-09-2010
04-10-2010
04-11-2010
04-12-2010
04-13-2010
04-14-2010
04-15-2010
04-16-2010
04-17-2010
04-18-2010
04-19-2010
04-20-2010
04-21-2010
04-22-2010
04-23-2010


Actual result:
--------------
03-22-2010
03-23-2010
03-24-2010
03-25-2010
03-26-2010
03-27-2010
03-28-2010
03-29-2010
03-30-2010
03-31-2010
04-01-2010
04-01-2010
04-02-2010
04-03-2010
12-31-1969
04-05-2010
04-06-2010
04-07-2010
04-08-2010
04-09-2010
04-10-2010
04-11-2010
04-12-2010
04-13-2010
04-14-2010
04-15-2010
04-16-2010
04-17-2010
04-18-2010
04-19-2010
04-20-2010

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-04 19:30 UTC] escot001 at student dot ucr dot edu
fixed in 4.3.6, sorry guys.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC