#48454 [Ver]: touch() does not modify accessed time in Windows
| From: | kalle@php.net | Date: | Thu, 04 Jun 2009 05:49:04 +0000 |
| Subject: | #48454 [Ver]: touch() does not modify accessed time in Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-138035@lists.php.net to get a copy of this message | ||
ID: 48454
Updated by: kalle@php.net
Reported By: soapergem at gmail dot com
Status: Verified
Bug Type: Filesystem function related
Operating System: win32 only - Windows XP
PHP Version: 5.2.9
New Comment:
Reproduced in both 5.2.9, 5.2.10rc2-dev and 5.3.0rc3-dev on Vista
Previous Comments:
------------------------------------------------------------------------
[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