From: crestien at bellsouth dot net
Operating system: Windows 2000 Server
PHP version: 4.3.5
PHP Bug Type: Date/time related
Bug description: mktime() gives bad timestamp in april.
Description:
------------
This error only came about in April. I've had it on my intranet for about
a year now.. and all of a sudden I have two April 3rds on my Time Clock
and it's consistent on matter what year it's on. I cleared it up by just
adding an hour to the mktime() to force it further into the day.
This is a very normal setup of PHP. It's the stable release of 4.3.5 and
it's running IIS 5 as cgi per the auto installer
The only changes in the php.ini is my doc_root to a separate drive and my
extensions directory to c:\PHP.
This also did it on my home computer running 4.3.5 as a module on Apache
1.3.29 on Windows XP.
Reproduce code:
---------------
//Bad Code
for($i=1; $i<31; $i++) {
$timestamp = mktime(0,0,0,4,$i,2004);
echo date("F j", $timestamp)." - ".$timestamp."<br>";
}
//Jimmy Rigged Code - **Added 1 hour**
for($i=1; $i<31; $i++) {
$timestamp = mktime(1,0,0,4,$i,2004);
echo date("F j", $timestamp)." - ".$timestamp."<br>";
}
Expected result:
----------------
April 1 - 1080802800
April 2 - 1080889200
April 3 - 1080975600
April 4 - 1081058400
April 5 - 1081144800
April 6 - 1081231200
.
.
etc
Actual result:
--------------
April 1 - 1080799200
April 2 - 1080885600
April 3 - 1080972000
April 3 - 1081054800
April 5 - 1081141200
April 6 - 1081227600
.
.
etc
--
Edit bug report at http://bugs.php.net/?id=27970&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27970&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27970&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27970&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27970&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27970&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27970&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27970&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27970&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27970&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27970&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27970&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27970&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27970&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27970&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27970&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27970&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27970&r=float