From:             m dot konings at knowmany dot nl
Operating system: Windows
PHP version:      4.3.5
PHP Bug Type:     Date/time related
Bug description:  mktime() has problems with DST

Description:
------------
When iterating through a date value, day by day, I use the following code
a lot:



$cur_date = mktime(0, 0, 0, date('m', $cur_date), date('d', $cur_date)+1,
date('Y', $cur_date));



This used to work perfectly on PHP 4.3.4. But with 4.3.5 this call keeps
returning 27-3-2004 as soon as it hits this date. I guest this has
something to do with Daylight Saving Time. When you change to call to:



$cur_date = mktime(1, 0, 0, date('m', $cur_date), date('d', $cur_date)+1,
date('Y', $cur_date));



It actually works fine, so it turns out that 00:00:00 @ 28-3-2004 is
treated as 27-3-2004.



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

$cur_date = mktime(0, 0, 0, 3, 1, 2004);

while($dummy++ < 31) {

        echo date('d-m-Y', $cur_date)."<br>\n";

        $cur_date = mktime(0, 0, 0, date('m', $cur_date), date('d', $cur_date)+1,
date('Y', $cur_date));  

}

Expected result:
----------------
I expected to see the next list (as it worked on 4.3.4):



20-03-2004

21-03-2004

22-03-2004

23-03-2004

24-03-2004

25-03-2004

26-03-2004

27-03-2004

28-03-2004

29-03-2004



Actual result:
--------------
But I actually saw this:



20-03-2004

21-03-2004

22-03-2004

23-03-2004

24-03-2004

25-03-2004

26-03-2004

27-03-2004

27-03-2004

27-03-2004

-- 
Edit bug report at http://bugs.php.net/?id=27737&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27737&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27737&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27737&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27737&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27737&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27737&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27737&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27737&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27737&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27737&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27737&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27737&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27737&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27737&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27737&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27737&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27737&r=float

Reply via email to