#48454 [Opn->Ver]: touch() does not modify accessed time in Windows
| From: | jani@php.net | Date: | Tue, 02 Jun 2009 20:05:40 +0000 |
| Subject: | #48454 [Opn->Ver]: touch() does not modify accessed time in Windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137986@lists.php.net to get a copy of this message | ||
ID: 48454
Updated by: jani@php.net
Reported By: soapergem at gmail dot com
-Status: Open
+Status: Verified
Bug Type: Filesystem function related
-Operating System: Windows XP
+Operating System: win32 only - Windows XP
PHP Version: 5.2.9
New Comment:
Works fine with *nix, fails with Windows.
Previous Comments:
------------------------------------------------------------------------
[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