ID: 48245
Updated by: [email protected]
Reported By: RQuadling at GMail dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Windows XP SP3
PHP Version: 5.3CVS-2009-05-12 (snap)
New Comment:
Just checking: Are the dates correct in the files when you check them
without PHP? (like dir something..dunno, *nix has 'ls -l' :)
Previous Comments:
------------------------------------------------------------------------
[2009-05-13 08:30:39] RQuadling at GMail dot com
If I use the -n option for V5.3 to not use my INI file, I get the
normal notice regarding a lack of timezone settings ...
"It is not safe to rely on the system's timezone settings. You are
*required* to use the date.timezone setting or the
date_default_timezone_set() function. In case you used any of
those methods and you are still getting this warning, you most
likely misspelled the timezone identifier. We selected
'Europe/London' for '1.0/DST'"
date
date/time support => enabled
"Olson" Timezone Database Version => 2009.7
Timezone Database => internal
Default timezone => Europe/London
Directive => Local Value => Master Value
date.default_latitude => 50.3870 => 50.3870
date.default_longitude => -3.9520 => -3.9520
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => Europe/London => Europe/London
------------------------------------------------------------------------
[2009-05-13 08:28:09] RQuadling at GMail dot com
No difference...
>php -n -f z:\testDST.php
PHP V5.2.10-dev OS:WINNT SAPI:cli
Loaded INI:
Wanted to set the date to : (1242216855) 1 Wed, 13 May 2009 13:14:15
+0100
File was set to : (1242216855) 1 Wed, 13 May 2009 13:14:15
+0100
Match
Wanted to set the date to : (1233633906) 0 Tue, 03 Feb 2009 04:05:06
+0000
File was set to : (1233630306) 0 Tue, 03 Feb 2009 03:05:06
+0000
Different
Wanted to set the date to : (1222830306) 1 Wed, 01 Oct 2008 04:05:06
+0100
File was set to : (1222830306) 1 Wed, 01 Oct 2008 04:05:06
+0100
Match
and
PHP V5.3.0RC3-dev OS:WINNT SAPI:cli
Loaded INI:D:\PHP\INI\php-cli.ini
Wanted to set the date to : (1242216855) 1 Wed, 13 May 2009 13:14:15
+0100
File was set to : (1242216855) 1 Wed, 13 May 2009 13:14:15
+0100
Match
Wanted to set the date to : (1233633906) 0 Tue, 03 Feb 2009 04:05:06
+0000
File was set to : (1233630306) 0 Tue, 03 Feb 2009 03:05:06
+0000
Different
Wanted to set the date to : (1222830306) 1 Wed, 01 Oct 2008 04:05:06
+0100
File was set to : (1222830306) 1 Wed, 01 Oct 2008 04:05:06
+0100
Match
With the latest 5.2 and 5.3 snapshots.
------------------------------------------------------------------------
[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