#45414 [NEW]: filemtime reports time shifted by daylight saving hours
From: marcello at vezz dot it
Operating system: Windows XP
PHP version: 5.2.6
PHP Bug Type: Filesystem function related
Bug description: filemtime reports time shifted by daylight saving hours
Description:
------------
I quote from Bug #40568:
PHP filemtime/fileatime/filectime (and maybe stat itself) functions
should use GetFileTime() Win32API (or GetFileAttributesEx()), not stat()
to retrieve the actual times from files. Otherwise the returned time is
shifted by one hour in some conditions.
This (mis)behaviour is actually DOCUMENTED by Microsoft, so it does not
qualify for "bogus - fix microsoft libraries" bug rejection -- Microsoft
already fixed their documentation and even indicated that "This behavior is
by design."
References:
http://support.microsoft.com/kb/158588
http://support.microsoft.com/kb/190315
http://msdn2.microsoft.com/en-gb/library/ms724290.aspx
http://us3.php.net/manual/en/function.stat.php#58404
http://www.codeproject.com/datetime/dstbugs.asp
Reproduce code:
---------------
<?php
$fullfilename='test.dll';
$ft=filemtime($fullfilename);
touch($fullfilename.'.md5',$ft);
$nt=filemtime($fullfilename.'.md5');
echo $ft.' : '.$nt;
?>
Please get test.dll from http://www.vezz.it/php/test.zip
Original file modification date:
19 feb 2008, 19.08.47
Expected result:
----------------
filemtime should return the same result for the two files.
1203440927 : 1203440927
Actual result:
--------------
1203440927 : 1203437327
The touched file date is one hour back.
19 feb 2008, 18.08.47 instead of 19 feb 2008, 19.08.47
--
Edit bug report at http://bugs.php.net/?id=45414&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45414&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45414&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45414&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45414&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=45414&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45414&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45414&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45414&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45414&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45414&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=45414&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=45414&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45414&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45414&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45414&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45414&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45414&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45414&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45414&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45414&r=mysqlcfg
Thread (3 messages)
- marcello at vezz dot it