ID:               48245
 Updated by:       [email protected]
 Reported By:      RQuadling at GMail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Date/time related
 Operating System: Windows XP SP3
 PHP Version:      5.3CVS-2009-05-12 (snap)
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2009-05-12 14:30:23] RQuadling at GMail dot com

Description:
------------
Touching a file with a non DST datetime and then reading it back is 
losing 1 hour.

Using Procmon, Windows is getting and returning the correct times.

It seems that PHP is adjusting the times it gets when in DST and 
reading a file NOT in DST.





Reproduce code:
---------------
<?php
// Create a dummy file.
$s_File = getenv('TEMP') . DIRECTORY_SEPARATOR . 'junktime.txt';
file_put_contents($s_File, 'JUNK');

$a_Dates = array(
  'Some time today' => strtotime('today 13:14:15'),
  'January 1st'     => strtotime('2009/02/03 04:05:06'),
  'October 1st'     => strtotime('2008/10/01 04:05:06'),
);

foreach($a_Dates as $s_When => $dt_Date) {
  touch($s_File, $dt_Date);
  clearstatcache();
  $dt_Modified = filemtime($s_File);

  echo
    'Wanted to set the date to : (', $dt_Date, ') ', date('r',
$dt_Date), PHP_EOL,
    'File was set to           : (', $dt_Modified, ') ', date('r',
$dt_Modified), PHP_EOL,
    ($dt_Date === $dt_Modified ? 'Match' : 'Different'), PHP_EOL,
PHP_EOL;
}

// Clean-up
unlink($s_File);

Expected result:
----------------
Wanted to set the date to : (1242130455) Tue, 12 May 2009 13:14:15 
+0100
File was set to           : (1242130455) Tue, 12 May 2009 13:14:15 
+0100
Match

Wanted to set the date to : (1233633906) Tue, 03 Feb 2009 04:05:06 
+0000
File was set to           : (1233633906) Tue, 03 Feb 2009 04:05:06 
+0000
Match

Wanted to set the date to : (1222830306) Wed, 01 Oct 2008 04:05:06 
+0100
File was set to           : (1222830306) Wed, 01 Oct 2008 04:05:06 
+0100
Match

Actual result:
--------------
Wanted to set the date to : (1242130455) Tue, 12 May 2009 13:14:15 
+0100
File was set to           : (1242130455) Tue, 12 May 2009 13:14:15 
+0100
Match

Wanted to set the date to : (1233633906) Tue, 03 Feb 2009 04:05:06 
+0000
File was set to           : (1233630306) Tue, 03 Feb 2009 03:05:06 
+0000
Different

Wanted to set the date to : (1222830306) Wed, 01 Oct 2008 04:05:06 
+0100
File was set to           : (1222830306) Wed, 01 Oct 2008 04:05:06 
+0100
Match


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48245&edit=1

Reply via email to