From: piefra at gmail dot com
Operating system: bof win(5) & linux(4.1)
PHP version: 5.2.3
PHP Bug Type: Date/time related
Bug description: error between date and mktime
Description:
------------
(sorry for my english i'm french )
using timestamp incrementation with date(H), i found somme datetime error
:
the error occur on the same hours ( 02:00 )
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 03:00
reproductible on every years same month ( end mars )
2007/03/25 03:00,2008/03/30 03:00,2009/03/29 03:00,2010/03/28 03:00
2011/03/27 03:00,2012/03/25 03:00,2013/03/31 03:00,2014/03/30 03:00
2015/03/29 03:00 ...
to find date errors run the code
found on windows/wamp 1.5.0 (php 5.1)
tested on linux/mandriva/appache with php 4.1
all plateform test is x86
Reproduce code:
---------------
<?php
session_cache_expire (0);
echo '<pre>';
$dt1=mktime(0,0,0,1,1,2007);
echo date("Y/m/d H:i",$dt1)."\n";
for ($i=1;$i<24*365*20;$i++){
set_time_limit(0);
$dt2=mktime(date("H",$dt1)+1,date("i",$dt1),0,date("m",$dt1),date("d",$dt1),date("Y",$dt1));
$d=date("H",$dt2)-date("H",$dt1);
if ($d<>1 and $d <>-23) {
echo date("Y/m/d H:i",$dt1)." ".date("Y/m/d H:i",$dt2)."\n";
flush();
}
$dt1=$dt2;
}
echo date("Y/m/d H:i",$dt2)."\n";
echo '<pre>';
?>
Expected result:
----------------
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 02:00
Actual result:
--------------
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 03:00
--
Edit bug report at http://bugs.php.net/?id=42376&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42376&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42376&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42376&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42376&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42376&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42376&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42376&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42376&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42376&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42376&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42376&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42376&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42376&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42376&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42376&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42376&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42376&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42376&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42376&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42376&r=mysqlcfg