php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4454 mktime() returns -1 if year is less than 1970
Submitted: 2000-05-15 12:02 UTC Modified: 2000-06-13 23:15 UTC
From: ed at linkstream dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Release Candidate 2 OS: NT 4.0 (SP4)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ed at linkstream dot net
New email:
PHP Version: OS:

 

 [2000-05-15 12:02 UTC] ed at linkstream dot net
mktime() returns with -1 if year is less than 1970. If embedded in a call to the date() function, it will crash the scripting engine.

this call will return -1:
   mktime(0,0,0,10,24,1969);

this call returns valid timestamp:
   mktime(0,0,0,10,24,1970);

this will crash the PHP engine:
   date("l, jS F, Y", mktime(0,0,0,10,24,1969));


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-22 05:15 UTC] joey at cvs dot php dot net
Look at the manual: (http://www.php.net/manual/function.mktime.php)

"Returns the Unix timestamp corresponding to the arguments given. 
 This timestamp is a long integer containing the number of seconds
 between the Unix Epoch (January 1 1970) and the time specified."

But this should still not crash the engine. Any call to 
date("...", -1);
on my machine simply prints the info for 1 second before Jan. 1st,
1970.

Do you still see a crash?
 [2000-06-13 23:15 UTC] andrei at cvs dot php dot net
This does not happen with the latest release anymore.
 [2002-06-22 14:19 UTC] ldprice at attbi dot com
mktime returns -1 in the following code with Windows XP Pro, PHP 4.1.1, IIS 5.1  Same problem oh Windows 2000 Server, PHP 4.2.1, Apache/2.0.39 (Win32)

return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));

Date of Birth:   
Warning: unexpected error in date() in C:\catalog\includes\functions\general.php on line 531
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 16:01:27 2024 UTC