Bug #4454 Updated: mktime() returns -1 if year is less than 1970

From: Date: Sat, 22 Jun 2002 18:19:45 +0000
Subject: Bug #4454 Updated: mktime() returns -1 if year is less than 1970
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11806@lists.php.net to get a copy of this message
ID: 4454 Updated by: ldprice@attbi.com Reported By: ed@linkstream.net Status: Closed Bug Type: Scripting Engine problem Operating System: NT 4.0 (SP4) PHP Version: 4.0 Release Candidate 2 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2000-06-13 23:15:41] andrei@cvs.php.net This does not happen with the latest release anymore. ------------------------------------------------------------------------ [2000-05-22 05:15:47] joey@cvs.php.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-05-15 12:02:20] ed@linkstream.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)); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=4454&edit=1

« previous php.bugs (#11806) next »