Doc #66159 [Csd->Nab]: fileatime() only returns file creation date, not file accessed.
| From: | ab@php.net | Date: | Sun, 05 Jan 2014 23:53:28 +0000 |
| Subject: | Doc #66159 [Csd->Nab]: fileatime() only returns file creation date, not file accessed. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-10817@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66159&edit=1
ID: 66159
Updated by: ab@php.net
Reported by: webzuru at yahoo dot com
Summary: fileatime() only returns file creation date, not
file accessed.
-Status: Closed
+Status: Not a bug
Type: Documentation Problem
Package: Filesystem function related
Operating System: Windows 7
PHP Version: Irrelevant
Assigned To: ab
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2014-01-05 23:42:48] ab@php.net
That's obviously has nothing to do with PHP, but with the system settings and filesystem type.
The relevant settings you can check with the commando
fsutil behavior query DisableLastAccess
Be sure it's set to 0, to change run cmd as admin and invoke
fsutil behavior set DisableLastAccess 0
By default updating the atime was disabled in Vista AFAIR. Also note that the atime has 1 hour
resolution on NTFS.
Cheers
------------------------------------------------------------------------
[2013-11-23 15:21:46] webzuru at yahoo dot com
Description:
------------
fileatime() function is supposed to return 'last access time of the given file' however,
in windows that is not the case. It only returns the date when the file was created. This may be
related to windows file permission issue, which should be worth mentioning in the documentation.
Test script:
---------------
<?php
/*
* this only returns the date the file was created.
*/
var_dump(date('d', fileatime('foo.txt')));
//string '13' (length=2)
Expected result:
----------------
I expect to see date in which the file was last accessed or modified.
Actual result:
--------------
21
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66159&edit=1