php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45414 filemtime reports time shifted by daylight saving hours
Submitted: 2008-07-02 09:58 UTC Modified: 2008-07-02 10:37 UTC
From: marcello at vezz dot it Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.2.6 OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marcello at vezz dot it
New email:
PHP Version: OS:

 

 [2008-07-02 09:58 UTC] marcello at vezz dot it
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-02 10:12 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Bug #40568 is not bogus or closed, it's suspended..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC