#48454 [Ver->Csd]: touch() does not modify accessed time in Windows
| From: | pajoye@php.net | Date: | Tue, 18 Aug 2009 14:47:58 +0000 |
| Subject: | #48454 [Ver->Csd]: touch() does not modify accessed time in Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141195@lists.php.net to get a copy of this message | ||
ID: 48454
Updated by: pajoye@php.net
Reported By: soapergem at gmail dot com
-Status: Verified
+Status: Closed
Bug Type: Filesystem function related
Operating System: win32 only - Windows XP
PHP Version: 5.2.9
-Assigned To:
+Assigned To: pajoye
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in 5.3+
Previous Comments:
------------------------------------------------------------------------
[2009-06-04 05:49:03] kalle@php.net
Reproduced in both 5.2.9, 5.2.10rc2-dev and 5.3.0rc3-dev on Vista
------------------------------------------------------------------------
[2009-06-02 20:05:39] jani@php.net
Works fine with *nix, fails with Windows.
------------------------------------------------------------------------
[2009-06-02 15:52:05] soapergem at gmail dot com
Description:
------------
The touch() command does not actually modify the accessed time of a
file on a Windows platform. After calling touch() on a file with an
access time specified, the access time is set to the current time.
Reproduce code:
---------------
<?php
$file = 'C:\\test.txt';
$mtime = filemtime($file);
$atime = fileatime($file);
$newtime = mktime(0, 0, 0, 1, 1, 2009);
$result1 = touch($file, $mtime, $newtime);
$result2 = ( $atime != fileatime($file) );
var_dump($result1);
var_dump($result2);
?>
Expected result:
----------------
On the first run, we should expect the file C:\test.txt to have an
access time of January 1st, 2009, and this expected PHP output:
bool(true)
bool(true)
Actual result:
--------------
Instead, the file C:\test.txt will have an access time of whenever the
script ran, and this is the PHP output we get:
bool(true)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48454&edit=1