From: Hua dot Qu at volvo dot com
Operating system: Windows 2000
PHP version: 4.3.4
PHP Bug Type: Date/time related
Bug description: strtotime(+1 xxx) returns 1 more hours
Description:
------------
strtotime($tm + 1 xxx) always adds one more hour to the result, if the
result-time is in the summertime, no matter $tm is in the summertime or
not.
It is the same in PHP CVS (5.0.x-dev) Built On: Mar 30, 2004 14:30 GMT
I think it is the daylight-savings-time problem. Perhaps, $tm is not
checked if it is already in the daylight-savings-time.
There are already some similar reports, but they did not get the point,
and the bug has not been corrected untill Mar 30, 2004 14:30 GMT.
Reproduce code:
---------------
echo "I have get one hour too much!<br><br>";
$to = "2004-06-01 00:00:00";
echo strtotime($to)."<br>\n";
echo strtotime("$to +1 seconds ")."<br><br>\n";
$newtime1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 seconds "));
$newtime2 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day "));
echo "$to <br>\n";
echo "+1 s= $newtime1<br>\n";
echo "+1day=$newtime2<br><br>\n";
$correct = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 second -1
hour"));
echo "correct: +1 s=$correct<br>";
Expected result:
----------------
If $tm is the summertime, strtotime($tm +1 day) should return 24 hours
more, not 25 hours more.
If $tm is the wintertime and result is in the summertime, it should return
one extra hour.
--
Edit bug report at http://bugs.php.net/?id=27780&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27780&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27780&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27780&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27780&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27780&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27780&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27780&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27780&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27780&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27780&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27780&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27780&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27780&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27780&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27780&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27780&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27780&r=float